Why are preload link not working for JSON requests ?

后端 未结 9 688
星月不相逢
星月不相逢 2020-12-30 02:24

The JavaScript on my website loads several JSON to initialize itself.

I would like to preload them so, when the JavaScript will launch an Ajax request on it, they wi

9条回答
  •  离开以前
    2020-12-30 02:54

    According to https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content , you have to add as="fetch" for JSON files. So your code becomes

    It's supported by all modern browsers and you get a warning message if this resource is not used within a few seconds because it is counterproductive to "preload" it in a such case (delay, double load etc.)

    It's different from which is to anticipate future navigation and not supported widely.

    A Chrome illustrated article about this: https://medium.com/reloading/preload-prefetch-and-priorities-in-chrome-776165961bbf

提交回复
热议问题