Title: Don&#039;t work when &quot;defer javascript&quot;
Last modified: August 21, 2016

---

# Don't work when "defer javascript"

 *  [dimbert](https://wordpress.org/support/users/dimbert/)
 * (@dimbert)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/)
 * Hi, to all.
 * First of all, thanks a lot of this incredible plugin… amazing
 * Now I’m working with google pagespeed to achieve the highest score as possible.
   One of the better things to do is defer the javascript. (this can be done automatically
   by using PageSpeed Module).
 * All my plugins still working nice except Wp Retina. Any idea if there are a way
   to fix it?
 * Tks in Advance
 * [http://wordpress.org/plugins/wp-retina-2x/](http://wordpress.org/plugins/wp-retina-2x/)

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

 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/#post-4007509)
 * With PageSpeed you’d be better using the HTML Rewriter method, and disable the
   caching plugin (if you have one) you are using on the WP side.
 *  Thread Starter [dimbert](https://wordpress.org/support/users/dimbert/)
 * (@dimbert)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/#post-4007674)
 * I don’t know why… But for me the HTML Rewriter don’t work… (maybe a permission
   issue?). Any idea how to fix it?
 * Now, I just searched the web and looks like if you insert a specific tag it tells
   to pagespeed to not touch your .js
 * See the link, I think it can help… with time, more and more users are gonna use
   wp retina 2x + Google Pagespeed
 * [https://developers.google.com/speed/pagespeed/module/filter-js-defer](https://developers.google.com/speed/pagespeed/module/filter-js-defer)
 * Tks
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/#post-4007698)
 * The problem is unrelated to Google Page Speed. I use it as well as the HTML Rewriter.
 * Can you try to see if it works without the HTML Rewriter? And if you active the
   mode DEBUG of the plugin?
 *  Thread Starter [dimbert](https://wordpress.org/support/users/dimbert/)
 * (@dimbert)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/#post-4007713)
 * I know that the HTML Rewriter is not affected by PageSpeed….
 * When I use the client side, everything works fine (but is kinda slow).
 * When I turn on HTML Rewrite, nothing happens (and no errors in the FireBug)… 
   maybe a problem with .htaccess?
 * That’s my .htaccess:
 *     ```
       #Gzip
       <ifmodule mod_deflate.c>
       AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
       </ifmodule>
       #End Gzip
   
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /cursos/
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /cursos/index.php [L]
       </IfModule>
   
       # END WordPress
       ```
   
 * Tks for the help
 * Question #2
 * The link that I sent to you, has the code to be inserted in the .js to make possible
   using the retina.js when the function defer javascript (that is a option, not
   default) is on.
 * I think is a good thing to add to your .js (increase compability with this feature)
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/#post-4007718)
 * > When I turn on HTML Rewrite, nothing happens (and no errors in the FireBug)…
   > maybe a problem with .htaccess?
 * The HTML Rewrite doesn’t use the .htaccess.
    However if you use HTML caching (
   through a plugin or your hosting service) it might not work. Otherwise… it should
   😉
 * > I think is a good thing to add to your .js (increase compability with this 
   > feature)
 * Very good remark actually and I should do that. There is no way to do it simply
   with the WordPress API though… except if I trick it (which I don’t want to do).
   I keep this in mind and definitely will react ASAP when I can do something 🙂
 *  Thread Starter [dimbert](https://wordpress.org/support/users/dimbert/)
 * (@dimbert)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/#post-4007721)
 * Tks for your response… But I still can’t find out why the Rewrite don’t work…
 * If I turn off my only caching (Pagespeed), clear the browser cache, still have
   no success at all… Very weird…. Do you think it can be something related to my
   theme?
 * If you wan’t to take a look…
 * [http://www.coexiste.com.br/cursos](http://www.coexiste.com.br/cursos)
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/#post-4007722)
 * It can be many many things… Maybe you should try running the website on your 
   localhost and do some testing, maybe with a different theme, different plugins,
   etc.

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

The topic ‘Don't work when "defer javascript"’ is closed to new replies.

 * ![](https://ps.w.org/wp-retina-2x/assets/icon-256x256.png?rev=2597316)
 * [Perfect Images: Regenerate Thumbnails, Image Sizes, WebP & AVIF](https://wordpress.org/plugins/wp-retina-2x/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-retina-2x/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-retina-2x/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-retina-2x/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-retina-2x/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-retina-2x/reviews/)

## Tags

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

 * 7 replies
 * 2 participants
 * Last reply from: [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/dont-work-when-defer-javascript/#post-4007722)
 * Status: not resolved