How to defer javascript in phpBB?

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
Locked
User avatar
John connor
Registered User
Posts: 2237
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

How to defer javascript in phpBB?

Post by John connor » Tue Apr 05, 2016 5:56 am

In an effort to defer JS to speed up my forum I was reading this: https://varvy.com/pagespeed/defer-loadi ... cript.html

But I thought I could use the code in index.php, well, that didn't work. How in the world do I do this in PHP since there isn't a HTML doc being loaded?

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21558
Joined: Fri Aug 29, 2008 9:49 am
Location: Caerdydd

Re: How to defer javascript in phpBB?

Post by Mick » Tue Apr 05, 2016 11:09 am

You should be asking in extension writers or wherever you got the code from.
"The more connected we get the more alone we become" - Kyle Broflovski

User avatar
John connor
Registered User
Posts: 2237
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: How to defer javascript in phpBB?

Post by John connor » Wed Apr 06, 2016 3:10 am

I have 16 JS files, they are from extensions. All I'm asking is how to differ those scripts to load after the main site loads and I should be able to do this in the index.php file to defer the JS.

User avatar
david63
Registered User
Posts: 16534
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: How to defer javascript in phpBB?

Post by david63 » Wed Apr 06, 2016 6:31 am

And what about all the "core" js files - not to mention the js that is actually within core pages.

Extensions, if written correctly should only load js as and when needed
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
John connor
Registered User
Posts: 2237
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: How to defer javascript in phpBB?

Post by John connor » Wed Apr 06, 2016 10:48 am

When I go here https://varvy.com/pagespeed/ there are 15 JS files from extensions that can be deferred.

Is there a way to change that code in the link I gave in my first post to work in PHP so I can defer the 15 JS files?

It can be done in Wordpress and there are many solutions. Since that is PHP driven I'd imagine it could be done with phpBB.

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21558
Joined: Fri Aug 29, 2008 9:49 am
Location: Caerdydd

Re: How to defer javascript in phpBB?

Post by Mick » Wed Apr 06, 2016 10:57 am

John connor wrote:All I'm asking is how to differ those scripts
Support is not the place to be discussing coding, you know this:
3.1.x Support Forum wrote:Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
"The more connected we get the more alone we become" - Kyle Broflovski

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51863
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: How to defer javascript in phpBB?

Post by Brf » Wed Apr 06, 2016 1:45 pm

John connor wrote:Is there a way to change that code in the link I gave in my first post to work in PHP so I can defer the 15 JS files?
PHP does not load JS files.
JS files are loaded by the user's webbrowser when the resultant HTML page is loaded.

Locked

Return to “[3.1.x] Support Forum”