Preload script without execute

前端 未结 6 1865
生来不讨喜
生来不讨喜 2020-12-06 17:09

Problem

In order to improve the page performance I need to preload scripts that I will need to run on the bottom page.

I

6条回答
  •  借酒劲吻你
    2020-12-06 17:36

    You can use the prefetch attribute of a link tag to preload any resource, javascript included. As of this writing (Aug 10, 2016) it isn't supported in Safari, but is pretty much everywhere else:

    More info on support here: http://caniuse.com/#search=prefetch

    Note that IE 9,10 aren't listed in the caniuse matrix because Microsoft has discontinued support for them.

    More info here and more options for preloading, like prerender and more

提交回复
热议问题