Defer JS [Deleted]

Is there something I need to add to make it so XenCentral's trading addon js is defered? I'm going back to this to see if I can get this working properly.

Rather than defering, wouldn't it be smarter to just async the jss and css?????
 
Last edited:
@AzzidReign I don't think you can async CSS natively, you'd have to use javascript to do that.

As for js, using the async or defer properties of the <script> tag in HTML5 (neither of which are used by this addon) has drawbacks. The order of async loaded scripts is unreliable and as most of them depend on one another (jQuery) it would break a lot of things.

Async is more for when a script is a standalone script that is low priority, like Google Analytics or social media buttons.

This addon places them before the </body> tag instead, where the load order is maintained without delaying page rendering.

It shouldn't cause problems in the majority of cases, you shouldn't need to add anything to the blacklist in the ACP. If something is broken you should check the console before changing any settings.
 
I have just upgraded my host to PHP 5.5, then installed this got the below error message:

Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

I was still able to access to Admin CP, when i just click on the "File Health Check" then it appeared the same error as above. My whole board cannot be access with that error when i enable the add-on. If i disable it, it is back to normal without any issue.

Anyone receive the same error like that? Anyway to fix this plz? :oops:

Thanks!
 
@kevinchan check your server error logs for the actual error message

Below is the error message that i saw in the error log:

ErrorException: Fatal Error: syntax error, unexpected '[' - library/Jrahmy/DeferJs/Deferrer.php:65
Generated By: Admin user, Vài giây trước
Stack Trace
#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}
Request State
array(3) {
["url"] => string(33) "MY BOARD NAME"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

Read color = my forum URL

Please assist on this.

Thanks!
 
@Jeremy P It seems this addon does not know to ignore JS files within IE conditionals. Can you possibly provide a fix for that? Or have it move the IE confitionals with the script call?
 
@Jeremy P It seems this addon does not know to ignore JS files within IE conditionals. Can you possibly provide a fix for that? Or have it move the IE confitionals with the script call?
Hmm just add it to the ignore list in the options? It should leave it where it is.

It might break if it depends on jQuery though, in which case you'll have to ignore that too. I will keep this in mind for the next update, thanks for bringing it up.
 
Hmm just add it to the ignore list in the options? It should leave it where it is.

It might break if it depends on jQuery though, in which case you'll have to ignore that too. I will keep this in mind for the next update, thanks for bringing it up.
No problem, I think it should be moved together because you're right it will break.
 
Using it & disable it doesn't seem to change the "Defer parsing of JavaScript" rating in gtmetrix..
 
Last edited:
Using it & disable it doesn't seem to change the "Defer parsing of JavaScript" rating in gtmetrix..
Well the addon does its job as configured whether or not you get some more points on a website.

Personally for me it does affect the rating, but if it doesn't for you and that's what you want then feel free to disable/remove the addon.
 
I'm guessing I'm doing something wrong here... when I install it on my beta site, all of my ads then appear underneath the page content. So I added "doubleclick" (our ad network) to the blacklist string. That makes the ads disappear entirely.

Thoughts?
 
I'm guessing I'm doing something wrong here... when I install it on my beta site, all of my ads then appear underneath the page content. So I added "doubleclick" (our ad network) to the blacklist string. That makes the ads disappear entirely.

Thoughts?
Can you confirm that the ad scripts are left in place in the HTML source? They have no dependencies or any other scripts that would interfere?

If you give me a link to your site with it enabled I could take a look. It does look as if there are IE conditional scripts which should be added to the blacklist as well, but I'm not sure that they're the cause of the problem.
 
Hey Jeremy -

Thanks for the offer. I'm working through another ad-related issue right now (nothing to do with this) and will get back to you tomorrow so you can take a peek. Appreciate it!
 
@Digital Doctor

Eh. Unless it's causing server error logs then the only real conflict is the admin of the board. You need to know what deferring JS does and how it may cause issues. Once you do you may blacklist the ones that do not play nicely with it (and their dependencies).

Haven't had a look at the 1.4 issue yet. Sorry all.
 
Last edited:
Top Bottom