Support » Plugin: WebP Express » picturefill.min.js

  • Resolved thebigdotco

    (@thebigdotco)


    What does the following script do exactly? I notice it only appears on pages when you’re logged in. I ask because we have Jquery disabled, so at the moment it’s probably not doing anything, but images seem to be working as intended.

    <script>document.createElement( "picture" );if(!window.HTMLPictureElement && document.addEventListener) {window.addEventListener("DOMContentLoaded", function() {var s = document.createElement("script");s.src = "https://website.com/wp-content/plugins/webp-express/js/picturefill.min.js";document.body.appendChild(s);});}</script>

    • This topic was modified 3 years, 2 months ago by thebigdotco.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author rosell.dk

    (@roselldk)

    The picturefill script is inserted into all pages if you have enabled Alter HTML, have choosen “Replace tags with <picture> tags, adding the webp to srcset.” and have ticked off the “Dynamically load picturefill.js on older browsers” checkbox. I shall simply cite the helptext next to that checkbox:

    “If you enable this option, a small script will be added which detects if picture tags are supported and loads picturefill.js if not. It is recommended to activate this option, unless your theme or another plugin adds such a script. Picture tag support is currently ~88%”.

    The picturefill library is available here: https://github.com/scottjehl/picturefill

    The script should not only be inserted when you are logged in. Are you sure you haven’t missed something? It works in my end (it is also inserted when you are not logged in)

    The picturefill script is vanilla javascript and does not depend on jQuery

    Plugin Author rosell.dk

    (@roselldk)

    I should update the help text. I see that picture tag support has risen to ~92%…

    Thread Starter thebigdotco

    (@thebigdotco)

    No, you’re right it also appears when not logged in. Great that it doesn’t rely on JQuery.

    Keep up the great work 🙂

    Plugin Author rosell.dk

    (@roselldk)

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘picturefill.min.js’ is closed to new replies.