How to make JavaScript execute after page load?

前端 未结 24 2406
孤城傲影
孤城傲影 2020-11-21 05:55

I\'m executing an external script, using a

24条回答
  •  长发绾君心
    2020-11-21 06:18

    Here's a script based on deferred js loading after the page is loaded,

    
    

    Where do I place this?

    Paste code in your HTML just before the tag (near the bottom of your HTML file).

    What does it do?

    This code says wait for the entire document to load, then load the external file deferredfunctions.js.

    Here's an example of the above code - Defer Rendering of JS

    I wrote this based on defered loading of javascript pagespeed google concept and also sourced from this article Defer loading javascript

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题