Feature #17035
closedApproach and patch for removing all inline JavaScript
0%
Description
Installations with extensive GMENUs and rollover effects will still have major parts of JavaScript within the HTML source.
This is alright according server load, since this JavaScript mainly consists of image variables which might change on different pages depending on ACT, CUR and the like and therefore would result in different external .js files anyway when outsourced. But there might be circumstances (e.g. beautifying HTML source or optimizing for search engines), where this behaviour is disliked: the actual content of a page is outputted beneath loads of JavaScript code.
As an approach, the following patch against typo3/sysext/cms/tslib/class.tslib_pagegen.php introduces an additional TS property (config.removeAdditionalJS = external might be set), that only will have an effect if TS property config.removeDefaultJS is already set to external. Then, all the inline JavaScript will be outsourced to external files.
If considered to be merged to class.tslib_pagegen.php, the feature config.removeAdditionalJS should be marked as an advanced feature to be applied very carefully, since it requires decent configuration of other parts of the installation - some examples:
- imgNameNotRandom should be set for all menus; else the typo3temp directory will very quickly be congested by .js files (containing randomly named image variables)
- The default JavaScript libraries in media/scripts for [X]MENU_LAYERS (and probably other JavaScripts as well) will not work any more without modification since they rely on inline JavaScript (related to Bug 2970, but it doesn't fully solve the problem).
(issue imported from #M5064)
Files