Defer Parsing of JavaScript

Updated on Mar 13, 2019

Method Type: User (.JS)
(This means that the method is handled by the user)

Status:Must be applied by the user.

Introduction:

When loading a page, the web browser must download and parse all of the scripts before the page can be fully rendered. Defer parsing of JavaScript means that the script will be downloaded but the parsing will be postponed until needed to make the page loading faster.

How defer parsing of JavaScript works:

As not all JavaScript scripts are needed during the initial loading of the page, you can move all of the uncalled JS functions to a new external JS file. After that an initial event listener is needed for calling the external file after the page has loaded. This is the most simple method for defer parsing of JavaScript. However it will not reduce the size of JS that needs to be downloaded, it will only delay the parsing.

Advanced users can store JavaScript code in comments or string literals which can be later called via the eval () function.

Note

The following characters may interfere with a HTML or Javascript parser and should be avoided in string literals: <, >, ", ', \, and &.

Defer parsing of JavaScript provides the following Advantages:

Reduced loading speed times

On this page...

    Optimized SSD Web Hosting

    • Free Domain Transfer
    • Google PageSpeed Enabled
    • 24/7 Technical Support
    • Fast SSD Storage
    • Hack-free Protection
    • Free Cloudflare CDN
    • Immediate Activation
    View More