Title: Does not work when JavaScript is off, but should
Last modified: December 12, 2018

---

# Does not work when JavaScript is off, but should

 *  Resolved [roam92](https://wordpress.org/support/users/roam92/)
 * (@roam92)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/)
 * This is a cool plugin. Especially when adding the “fade-in effect” CSS given 
   on WPRocket’s website… Very cool. It seems pretty lightweight, and Yoast says
   it will not hurt your SEO.
 * But it has one problem. It will mess up your site’s layout if your visitor has
   JavaScript turned off, which people do for security, privacy, or performance 
   reasons.
 * Lazy Load by WPRocket does add <script>…</noscript> tags to your markup, which
   is good – but the problem is that two sets of  tags will still display and leave
   big blank holes plus shifted images all over your page when JavaScript is off.
 * However, this can be fixed. It just needs to disable the first (JS-based) set.
 * This plugin defect was first reported here over 4(!) years ago, but has not yet
   been fixed:
 * [https://wordpress.org/support/topic/problem-when-javascript-is-disabled/](https://wordpress.org/support/topic/problem-when-javascript-is-disabled/)
 * There are at least a couple ways the bug could be addressed. One idea was suggested
   in that post. Another is offered directly by Google here:
 * [https://developers.google.com/web/fundamentals/performance/lazy-loading-guidance/images-and-video/#javascript_availability](https://developers.google.com/web/fundamentals/performance/lazy-loading-guidance/images-and-video/#javascript_availability)
 * Hope this gets taken care of soon. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [roam92](https://wordpress.org/support/users/roam92/)
 * (@roam92)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/#post-10979890)
 * OK, so the solution is pretty simple.
 * Basically, the Rocket plugin should be adding this tiny piece of HTML code to
   every page where lazy loading is happening:
 * **`<noscript><style type="text/css">.rll-youtube-player,[data-lazy-src]{display:
   none !important;}</style></noscript>`**
 * Note this cannot go in a CSS style file, but likely needs to be put on every 
   page on your site. You could accomplish that by adding it to a HTML widget or
   code snippet, or modifying your theme’s child template. I put it in my footer.
 * It’s basically telling the browser to not display the duplicate/empty placeholder
   boxes when JavaScript is turned off. They mess up the page layout.
 * Bottom line: This code really should go in the Lazy Load by WP Rocket plugin 
   itself. It’s an easy no-brainer for no-JavaScript support, and probably was a
   simple oversight by the plugin authors, since everything else is in place for
   this to work.
 * Until it does go in, you can add it yourself.
 * (Disclaimer: No warranties expressed or implied 🙂
 *  Plugin Author [WP Media](https://wordpress.org/support/users/wp_media/)
 * (@wp_media)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/#post-11074101)
 * This is indeed missing, WP does add a no-js class in the body tag if JS is disabled,
   so something like this should be enough
 * `<style type="text/css">.no-js .rll-youtube-player, .no-js [data-lazy-src]{display:
   none !important;}</style>`
 *  Thread Starter [roam92](https://wordpress.org/support/users/roam92/)
 * (@roam92)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/#post-11074249)
 * Hi,
 * Thank you for all your responses, as well as the plugin update with the fixes
   to various issues in the new 2.x release!
 * One question regarding the helpful CSS code you just posted. That’s great you
   can leverage a no-js class that already exists in WordPress.
 * **But** this small code fix does not yet appear to be incorporated into the plugin
   itself… Shouldn’t it be??
 * This CSS code is specific only to the WP-Rocket Lazy Load plugin, so don’t you
   want to include it so that the plugin _will work without JavaScript for ALL users?_
 * I can certainly see no harm in doing so, only benefits. Thanks!
 *  Plugin Author [WP Media](https://wordpress.org/support/users/wp_media/)
 * (@wp_media)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/#post-11074706)
 * It will be included in the next version of the plugin yes
 *  Thread Starter [roam92](https://wordpress.org/support/users/roam92/)
 * (@roam92)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/#post-11074712)
 * Perfect, thank you!
 *  [yaaacov](https://wordpress.org/support/users/yaaacov/)
 * (@yaaacov)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/#post-11202973)
 * Hi,
    I’m interested in that functionality too. Thanks.
 * By the way : great plugin thanks for encouraging a sustainable way to develop
   websites!
 *  Thread Starter [roam92](https://wordpress.org/support/users/roam92/)
 * (@roam92)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/#post-11224863)
 * [@wp_media](https://wordpress.org/support/users/wp_media/)
 * Wondering, did you actually test version 2.x with JavaScript turned off in your
   browser?
 * I just did, and it looks like it works the same as version 1.x did… meaning it
   doesn’t work well. No change really from the broken layout in version 1.x of 
   the plugin, as far as I can tell.
 * TBH, I’m not certain that WordPress automatically adds a “no-js” class if JavaScript
   is disabled.
 * So, I restored my previous HTML hack from above, and things look OK again.
 * Any thoughts?? Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Does not work when JavaScript is off, but should’ is closed to new replies.

 * ![](https://ps.w.org/rocket-lazy-load/assets/icon-256x256.png?rev=2715509)
 * [LazyLoad Plugin – Lazy Load Images, Videos, and Iframes](https://wordpress.org/plugins/rocket-lazy-load/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rocket-lazy-load/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rocket-lazy-load/)
 * [Active Topics](https://wordpress.org/support/plugin/rocket-lazy-load/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rocket-lazy-load/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rocket-lazy-load/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 7 replies
 * 3 participants
 * Last reply from: [roam92](https://wordpress.org/support/users/roam92/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/does-not-work-when-javascript-is-off-but-should/#post-11224863)
 * Status: resolved