Defer JS [Deleted]

If you have something that forcibly caches dynamic content or pages for guests ([bd] Cache has this feature), then maybe..
I'd rather see the real-time result in the site's source code instead of GTMetrix though. If these bits were moved somewhere before </body> (no longer within <head>), then the add-on already did its job.
 
If you have something that forcibly caches dynamic content or pages for guests ([bd] Cache has this feature), then maybe..
I'd rather see the real-time result in the site's source code instead of GTMetrix though. If these bits were moved somewhere before </body> (no longer within <head>), then the add-on already did its job.

Thank you.
Just checked and the JS is between <body> and </body> so I don't know if it is okay or not?
 
Hi,

This is what I want to defer => https://gyazo.com/f9e73560a4343135a3576c7c91a6e0cb
This is what I wrote/added => https://gyazo.com/9861ba22c80bed19cabae255445304cb

It doesn't work, I don't see any change when using GTmetrix => https://gyazo.com/15fdb9a04821d1c3d73b435b5fdf2af6

What's wrong please?

TYVM.
There is no whitelist, just a blacklist. If you put those strings in the options, they will be excluded from being deferred.

Does your addon add a defer attribute? That would be very helpful,,, @Jeremy P
Looked into this by the way. This method won't work properly in IE9, which is why I hadn't used it prior. Since IE9 isn't a huge concern these days, I will do some further testing and see which method yields better results and go from there.
 
The Facebook one might be caused by the Facebook Page widget thingy. As for xenforo.js, jquery-1.11.0.min.js, etc., they seemed to be deferred just fine, so I have no idea.
 
@Lemminator Just had a look and the add-on is moving the scripts before the </body> tag, which is all that is expected. I'm not sure why Pagespeed doesn't consider them to be deferred or if they have other criteria. A future update is likely to use the <script defer ...> attribute in the HTML rather than placing them before </body>, maybe that will change the scoring... but I wouldn't worry too much about it in the meantime.
 
@Lemminator Just had a look and the add-on is moving the scripts before the </body> tag, which is all that is expected. I'm not sure why Pagespeed doesn't consider them to be deferred or if they have other criteria. A future update is likely to use the <script defer ...> attribute in the HTML rather than placing them before </body>, maybe that will change the scoring... but I wouldn't worry too much about it in the meantime.

i still have the problem by your add-on and by rocks bd cache (paid) ....
 
The add-on is doing what it's supposed to do, outside of that I can't really be of much help. I'm not sure why PageSpeed would still classify them as blocking (unless it depends on the content of the scripts or something). The next version of the add-on will use a newer mechanism to defer script execution, all I can recommend is trying that when it's available.

Still, this is a bit of a micro-optimization and I would worry more about how fast your site feels than what its raw PageSpeed score is. This is probably one of the less important things PageSpeed checks for, and your results seem to show you've covered the most important optimizations (as far as XF reasonably allows anyways).
 
Last edited:
@Jeremy P, Do you know that what code need to add via Deferred JavaScript: Blacklist for UI.X or [XB] Font Awesome themes?
Not off hand. If you have a problem you can post or PM a link to your site and I'll check it out.

Hi, i will Blacklist this script but i dont know why, could you help me please?
<script language="javascript" type="text/javascript" src="https://banners.webmasterplan.com/view.asp?ref=798956&site=9192&type=html&hnb=1&js=1"></script>
I'm not entirely sure what you're asking. You can add this script to the blacklist by putting a line with "webmasterplan.com" in the options if deferring it causes unexpected behavior.
 
@Jeremy P

When this is active on our site: https://www.avnirvana.com and attempting to Create New Thread on Firefox, we are redirected to the bottom of the page instead of the location of the thread title and message box.

It does not effect Chrome or Edge, for whatever reasons, but in FF, it is extremely aggravating.

I assume that one of the JS entries is causing it to do this... but not being a developer or coder, I am not sure how to figure out which one it would be... or how to resolve it.
 
@Jeremy P

When this is active on our site: https://www.avnirvana.com and attempting to Create New Thread on Firefox, we are redirected to the bottom of the page instead of the location of the thread title and message box.

It does not effect Chrome or Edge, for whatever reasons, but in FF, it is extremely aggravating.

I assume that one of the JS entries is causing it to do this... but not being a developer or coder, I am not sure how to figure out which one it would be... or how to resolve it.
Sorry, I'm not sure what would be the cause. Does it occur with all add-ons disabled? If so, it's probably something from the style itself. Hard to really tell short of adding scripts to the blacklist one by one until it works.

Is there a way I could exclude certain templates (rather than JS scripts) from this?
It's not that granular currently, it just does a big sweep on the final HTML output.
 
Top Bottom