Topic Closed
9 Posts


I search in the 'gpOutput::GetHead();' function to desabled the parsing of combined javascript.

Then i want to defer parsing in the end of the html document just before </body>


someone can said me where is the output function for javascript ?


7 years ago#6272

Josh S.
2K Posts
16 Themes
18 Plugins

Sorry to say, gpEasy does not have an option for outputing the javascript at the end of the document.

7 years ago#6274

483 Posts
1 Themes
1 Plugins

Hello Furuko,

can you describe a bit closer the issue? What's a purpose for moving all javascripts to the end of document/template?

Edited: 7 years ago#6275

9 Posts
Here some recommandation from Google Page Speed


Details from Google

There are several techniques that can be used to defer parsing of JavaScript. The simplest and preferred technique is to simply Defer loading of JavaScript until it is needed. A second technique is to use the <script async> attribute where appropriate, which prevents parsing from blocking the initial page load by deferring it until the browser's UI thread is not busy doing something else. If neither of these techniques is suitable, there are some additional techniques commonly used in mobile applications, described below:

When building mobile applications, it can be necessary to load all of the JavaScript needed by an application up front, so the application can continue to work when the user is offline. In this case, some applications, such as mobile Gmail, find it useful to load JavaScript in comments and later eval() the JavaScript when it is needed. This approach guarantees that all JavaScript is loaded during the initial page load, while not requiring that JavaScript to be parsed.

An alternative to storing code in comments is storing code in JavaScript string literals. When using this technique, the JavaScript is only parsed when needed, again by callingeval() on the string literal. This technique also allows an application to load JavaScript early, but defer parsing until it is needed.

Note that moving your '<script>' tags to the end of the page is sub-optimal, since the browser will continue to show a busy indicator until the page has finished parsing this JavaScript. Users may wait until the page load indicator shows that the page load is complete before interacting with the page, so it is important to load JavaScript in a way that minimizes the time it takes for the browser to indicate that the page load is complete.

In our own tests conducted in early 2011, we found that on modern mobile devices, each additional kilobyte of JavaScript adds about 1ms of parse time to the overall page load time. So 100kB of JavaScript included in the initial page load would add 100ms of load time for your users. Because JavaScript must be parsed on every visit to a page, this added load time will be part of every page load, whether loaded from the network, via the browser cache, or in HTML5 offline mode.

Pehaps someone can make a plugin ?

Edited: 7 years ago#6277

483 Posts
1 Themes
1 Plugins

Maybe this could be done with a combination of some gpEasy action-hook (called after the full page is assembled) and by using PHP's DOMdocument class as shown here. But there can be problem, if the page's body contains some script that depends on another script which should be already defined in head tag, something like jQuery(function(){...}); or similar, then such a code won't work. Imo it seems to be a non trivial problem.

Edited: 7 years ago#6278

193 Posts
1 Themes

I have read and tried the recommendations of putting the scripts at the bottom, and ran into the same problems Stano describes. For example, if you use jQuery to collapse an accordion menu:

  • with scripts at the bottom, all menus will be expanded when the page draws and collapse after the scripts have loaded, causing an annoying flash.
  • with scripts at the top, it will take a touch longer to load the page but when it displays, it will be in a finished state.

There are ways around that specific problem, but I think it will be hard to get all the plugins to work with scripts at the end. In the best case scenario, we could get some scripts to load at the top and some at the bottom, but identifying them may be hard.

7 years ago#6281

Topic Closed



elFinder 2.1.50 in Upcoming Release

A new release for Typesetter is in the works with a lot of improvements including the ... Read More

Typesetter 5.1

Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In