Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
AlexJ Posted June 9, 2012 Posted June 9, 2012 https://developers.google.com/speed/pagespeed/insights#url=fearless-assassins.com&mobile=false&rule=DeferParsingJavaScript Can someone tell me how can I do that?
altenerg Posted June 10, 2012 Posted June 10, 2012 Good luck! http://community.invisionpower.com/topic/364174-ipb-search-the-following-search-terms-are-not-allowed-and-were-removed-from-your-query-javascript/
Rοb Posted June 11, 2012 Posted June 11, 2012 Hello, You can use an anonymous function to load the JavaScript, and place it at the bottom of your page. Something like:(function() { var o = document.createElement('script'); o.type = 'text/javascript'; o.async = true; o.src = '/path/to/your/javascript/file.js'; var a = document.getElementsByTagName('script')[0]; a.parentNode.insertBefore(o, a); })(); Doing that will defer the loading of that JavaScript until after the page has finished parsing. That's not always practical though, so you can also use the defer attribute:http://www.w3schools...cript_defer.aspEdit: There's a ton of information on Google, notably the following guidelines by Google themselves, inc example(s):https://developers.g...actices/payload Hope this helps! :smile:
altenerg Posted June 11, 2012 Posted June 11, 2012 How do you edit with defer or async when the line for IPB JavaScript is?:{parse template="includeJS" group="global" params="$jsModules"} That one line in globaltemplate is what spits out the list of <script type="text/javascript" src="... I'm trying now to see if it can be done for the includeJS template.
altenerg Posted June 11, 2012 Posted June 11, 2012 Well async gave the same result as moving javascript to footer. Everything worked except for QR and edit boxes. (that I know of) Edit: Gallery JS does not work also. Cuts almost 2 seconds! from "first view" page load speed though.
AlexJ Posted June 11, 2012 Author Posted June 11, 2012 Well async gave the same result as moving to footers. Everything worked except for GR and edit boxes. (that I know of) How to use async? Laymen term tutorial please? I appreciate your help, Thanks!
altenerg Posted June 11, 2012 Posted June 11, 2012 How to use async? Laymen term tutorial please? I appreciate your help, Thanks! Ha! I was thinking the same thing when I read... the above howto. If I get it to work without breaking anything I will post how to here.
altenerg Posted June 11, 2012 Posted June 11, 2012 Hello, You can use an anonymous function to load the JavaScript, and place it at the bottom of your page. Something like:(function() { var o = document.createElement('script'); o.type = 'text/javascript'; o.async = true; o.src = '/path/to/your/javascript/file.js'; var a = document.getElementsByTagName('script')[0]; a.parentNode.insertBefore(o, a); })(); Doing that will defer the loading of that JavaScript until after the page has finished parsing. That's not always practical though, so you can also use the defer attribute:http://www.w3schools...cript_defer.aspEdit: There's a ton of information on Google, notably the following guidelines by Google themselves, inc example(s):https://developers.g...actices/payload Hope this helps! :smile: Not as easy as you think. Implementing this (async) breaks java the same way moving to the footer does. I see you're read topic so I guess you also realize what you posted does not apply easily to IPB; thanks anyway
Rοb Posted June 11, 2012 Posted June 11, 2012 Not as easy as you think. Implementing this (async) breaks java the same way moving to the footer does. I see you're read topic so I guess you also realize what you posted does not apply easily to IPB; thanks anyway The OP made no mention of IP.Board, you're making an assumption.
AlexJ Posted June 12, 2012 Author Posted June 12, 2012 The OP made no mention of IP.Board, you're making an assumption. Sorry I thought this forum is about IPB talk and support.. so i didn't thought to mention about it. If you check the link it's fearless-assassins.com and it's running all IPB add-ons.
altenerg Posted June 12, 2012 Posted June 12, 2012 The OP made no mention of IP.Board, you're making an assumption. Bahaha! Seriously? Maybe he's taking about Wordpress. :thumbsup:
Rοb Posted June 12, 2012 Posted June 12, 2012 Bahaha! Seriously? Maybe he's taking about Wordpress. :thumbsup: Your sarcasm is very much misplaced. If you had taken the time to look carefully you'd have noted that this forum is not necessarily IPS-software specific, just look at the other threads - so yeah he could have been talking about Wordpress. Technically it's in the wrong section anyhow, hehe! Just so you know in future :smile:
altenerg Posted June 12, 2012 Posted June 12, 2012 Well, I guess I misunderstood the OP in my reply to his post and you understood him perfectly. Thanks! :smile:
Recommended Posts
Archived
This topic is now archived and is closed to further replies.