Source language: Translate to:

External js or inline?

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

External js or inline?

Postby fkapnist » Sat May 28, 2016 5:46 pm

Why does Google recommend external js but uses inline js for Look at the source of They found that in their particular case inlining works better (they practice the opposite of what they preach). The "expert" suggestions to use external js arouse during “the first age of the web” when scripts blocked rendering. Today PCs have gigabytes of RAM memory and modern browsers execute as soon as possible. In fact, more and more programmers are saying that it's best to inline all scripts, styles and templates - unless your script is extremely long or the same script is shared by several pages. One reason for this is because javascript does not support multi threading. The computer must wait for the long script to finish before continuing. This could lead to the dreaded "not responding due to long running script" error message. The best way to avoid this is to break up long scripts into a series of short ones connected with setTimeout() functions, to allow the PC to regain control or "breathe" between scripts. The only problem is that external js cannot contain <script> tags and therefore cannot be easily broken into smaller chunks. To add to the confusion, most mobile devices simply don't have much RAM to begin with and will slow down or freeze when executing very long scripts..... So does anyone know how to deal with the long running script problem?


User avatar
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 1 guest