0

I'm using this to preload/ defer css but is there a way to also do similar with javascipt files, I've looked everywhere I can think of but not found it, maybe I'm doing the wrong searches:

<link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/8.2.0/video-js.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'" integrity="sha512-akMT+LKE5CNd8NbHp0x0u6CoUJDZSMBFd5iunyEJReywcV9G10IJdNyCgxK+pnhDpnqsaPQsO3x7mnZZAs0CUA==" crossorigin="anonymous" referrerpolicy="no-referrer" > <noscript><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/8.2.0/video-js.min.css" integrity="sha512-akMT+LKE5CNd8NbHp0x0u6CoUJDZSMBFd5iunyEJReywcV9G10IJdNyCgxK+pnhDpnqsaPQsO3x7mnZZAs0CUA==" crossorigin="anonymous" referrerpolicy="no-referrer" ></noscript> 
3
  • 1
    You should be able to preload js files by setting <link rel="preload" as="script" href="critical.js"> Commented Mar 15, 2023 at 10:48
  • thats doesnt work for me, as ai get a "blank" screen then, its loading videojs and this warning pops up: The resource <URL> was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally. Commented Mar 15, 2023 at 12:50
  • It tells you that you are not using the preloaded script, try to look at this google developers article and see if that solves your problem. You need to create a script tag afterwards and use the preloaded resource. Commented Mar 15, 2023 at 13:02

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.