MyBB Community Forums

Full Version: move javascript and css to external scripts & stylesheets
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
so we can more easily implement CSP (content security policy), it'd be ideal if mybb would move its javascript and css from loading inline to external scripts and stylesheets.

I think this might also have some performance benefits as well.
If you were to make all javascript external you would probably never get rid of that message that says remove render blocking script, and every additional external file is another network request which will also add to your performance overhead. For performance purposes you may even want to take script out of external files and inline them, depending on how they are used.
(2016-08-01, 08:24 AM)Ashley1 Wrote: [ -> ]If you were to make all javascript external you would probably never get rid of that message that says remove render blocking script, and every additional external file is another network request which will also add to your performance overhead. For performance purposes you may even want to take script out of external files and inline them, depending on how they are used.

Most scripts can be moved to the end of <body> section (depending on how much the default layout will rely on JavaScript); HTTP/2 and server push will mitigate the impact of additional requests.
external scripts and stylesheets are easier to cache too, right?
I believe they are only cached if they are external. Don't think browsers cache inline scripts and styles. Also stylesheets must be contained within the <head></head> section.