Adlago Posted May 13, 2018 Share Posted May 13, 2018 Using Guest Terms is a good idea, but loading creates a defer parsing of all JS even when your JS is loaded before closing the body tag. I have found a solution and it is very common. It has to move that {template="guestTermsBar" if="!\IPS\Member::loggedIn()->member_id and \IPS\Settings::i()->guest_terms_bar" app="core" group="global" params="base64_encode( \IPS\Settings::i()->base_url )"} before {template="includeJS" if="theme.js_include == 'footer'" app="core" group="global" location="global" params=""} in footer Global Template. I did too many tests and everything works perfectly - without any defer parsing JS. Please move it to a next release - everyone will benefit. Thanks Link to comment Share on other sites More sharing options...
bfarber Posted May 14, 2018 Share Posted May 14, 2018 Can you please clarify this, as I'm not sure I understand what you're reporting? Quote but loading creates a defer parsing of all JS even when your JS is loaded before closing the body tag. Link to comment Share on other sites More sharing options...
Adlago Posted May 14, 2018 Author Share Posted May 14, 2018 The global template footer in the original location of these codes is ------------------------------------- {template="includeJS" if="theme.js_include == 'footer'" app="core" group="global" location="global" params=""} {template="guestTermsBar" if="!\IPS\Member::loggedIn()->member_id and \IPS\Settings::i()->guest_terms_bar" app="core" group="global" params="base64_encode( \IPS\Settings::i()->base_url )"} ---------------------------------------- When loading a site, this causes a defer parsing of all JS. A delay in loading a site is between 8 and 10 points. In order to have no defer parsing JS, you need to load after. Should be {template="guestTermsBar" if="!\IPS\Member::loggedIn()->member_id and \IPS\Settings::i()->guest_terms_bar" app="core" group="global" params="base64_encode( \IPS\Settings::i()->base_url )"} {template="includeJS" if="theme.js_include == 'footer'" app="core" group="global" location="global" params=""} Loading site in this way does not have a defer parsing JS. Link to comment Share on other sites More sharing options...
The Old Man Posted May 20, 2018 Share Posted May 20, 2018 I see what you mean @Adlago I just did a test before and after. I have JS set before the closing body tag and yet the GTMetrix score for deferring JS was an abysmal F(42). Quote 732.6KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering. After moving the line with guestTermsBar up just before includeJS in the globaltemplate, I now get a score of A(98): Quote 22.2KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering. Overal Pagespeed score D(68) increased to C(71), loading time 3.1 secs to 2.8 secs. I used to have a higher score B, sometimes A with IPS 4.2, so I need to see what's changed or broken as I also have less plugins now. Definitely a far cry from my Wordpress score though! Guestbarterms after includeJS (default): Guestbarterms before includeJS Wordpress: Link to comment Share on other sites More sharing options...
asigno Posted May 21, 2018 Share Posted May 21, 2018 Thanks for that @Adlago made the change, nice improvement. Would be great if all these things were done out of the box, but would be good to setup a thread just for page speed improvements. Code splitting would be another great improvement, to only load the JS which is needed at the time of request. Link to comment Share on other sites More sharing options...
Management Matt Posted May 21, 2018 Management Share Posted May 21, 2018 I made this change for 4.3.3. Link to comment Share on other sites More sharing options...
The Old Man Posted May 21, 2018 Share Posted May 21, 2018 Thank you Matt, that's great news! Have a donut! Link to comment Share on other sites More sharing options...
Management Matt Posted May 21, 2018 Management Share Posted May 21, 2018 2 minutes ago, The Old Man said: Thank you Matt, that's great news! Have a donut! Haha, just as I start my diet. Thanks! Link to comment Share on other sites More sharing options...
RevengeFNF Posted May 22, 2018 Share Posted May 22, 2018 I noticed that this change is already in 4.3.3 but i still get this at gtmetrix: Quote 670.9KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering. Link to comment Share on other sites More sharing options...
Adlago Posted May 22, 2018 Author Share Posted May 22, 2018 32 minutes ago, RevengeFNF said: I noticed that this change is already in 4.3.3 but i still get this at gtmetrix: Share your test please Link to comment Share on other sites More sharing options...
RevengeFNF Posted May 22, 2018 Share Posted May 22, 2018 1 minute ago, Adlago said: Share your test please I have sent you a pm. Link to comment Share on other sites More sharing options...
Adlago Posted May 22, 2018 Author Share Posted May 22, 2018 25 minutes ago, RevengeFNF said: I have sent you a pm. I found a reason for your defer parsing JS. See PM Link to comment Share on other sites More sharing options...
Adlago Posted May 22, 2018 Author Share Posted May 22, 2018 Tip for all those who still have a defer parsing JS. After the JS code, before closing the body tag, should not have a html code. Link to comment Share on other sites More sharing options...
RevengeFNF Posted May 22, 2018 Share Posted May 22, 2018 Thanks @Adlago In my case it was the plugin Smooth Scroller that was adding html code after the JS. Quote 1.0KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering. Link to comment Share on other sites More sharing options...
David.. Posted May 22, 2018 Share Posted May 22, 2018 I don't notice any difference on ours after 4.3.3 Link to comment Share on other sites More sharing options...
Adlago Posted May 22, 2018 Author Share Posted May 22, 2018 7 minutes ago, RevengeFNF said: 1.0KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering. this 1K is from your inline JS code Google analysis Link to comment Share on other sites More sharing options...
DSystem Posted May 22, 2018 Share Posted May 22, 2018 @Adlago Thanks for the tip. Quote Open for editing your theme - Custom Menu. Find "Javascript include location" and select "Just before </body> tag". Here was only to change this option that was perfect. ? Link to comment Share on other sites More sharing options...
Shehi Posted May 22, 2018 Share Posted May 22, 2018 And you guys broke Members filter in Admin CP!!! Link to comment Share on other sites More sharing options...
Adlago Posted May 22, 2018 Author Share Posted May 22, 2018 27 minutes ago, Shehi said: And you guys broke Members filter in Admin CP!!! Check templates in your theme - there are probably changes. Yet the topic here is for a defer parsing java script Link to comment Share on other sites More sharing options...
Shehi Posted May 23, 2018 Share Posted May 23, 2018 15 hours ago, Adlago said: Check templates in your theme - there are probably changes. Yet the topic here is for a defer parsing java script I use default theme for admin cp. Link to comment Share on other sites More sharing options...
Adlago Posted May 23, 2018 Author Share Posted May 23, 2018 29 minutes ago, Shehi said: I use default theme for admin cp. Please create ticket support in your client area Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.