When trying to rel="preload"
a video file using a <link>
tag in the <head>
I get a warning in the Chrome console stating:
<link rel=preload> must have a valid `as` value
My tag is:
<link rel="preload" href="https://storage.googleapis.com/[myFilePath].mp4" as="video" type="video/mp4" media="(min-width: 768px)" crossorigin>
The preload value of the <link> element's rel attribute lets you declare fetch requests in the HTML's <head> , specifying resources that your page will need very soon, which you want to start loading early in the page lifecycle, before browsers' main rendering machinery kicks in.
Preload is an early fetch instruction to the browser to request a resource needed for a page (key scripts, Web Fonts, hero images). Prefetch serves a slightly different use case — a future navigation by the user (e.g between views or pages) where fetched resources and requests need to persist across navigations.
Maybe this warning is a bug
[as]- this attribute is used when rel="preload" or rel="prefetch" has been set on the element. It specifies the type of content being loaded/prefetched Instead, 'preload' you can also use 'prefetch'
<link rel="prefetch" href="./img/intro.mp4" as="video">
So You can accomplish your task
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With