e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
318 stars 212 forks source link

[Feature request]: Provide an option to improve page loading times by using defer on all javascript files. #5192

Open CaMer0n opened 4 months ago

CaMer0n commented 4 months ago

Motivation

By using the defer attribute in HTML, the browser will load the script only after parsing (loading) the page. This can be helpful if you have a script that is dependent on other scripts, or if you want to improve the loading time of your page by loading scripts after the initial page load.

See https://www.marketingtracer.com/seo/improve-webpage-speed-defer-javascript

Proposed Solution

Move js 'settings' to its own file. Provide a flag to add 'defer' on all javascript files. Wrap inline code to make sure it is only executed after the page has loaded.

Alternatives

None

Additional Context

No response

CaMer0n commented 4 months ago

For now use: define('e_JS_DEFER', true);to test.

Jimmi08 commented 1 month ago

This change caused this:

https://github.com/e107inc/e107/issues/5246