Reputation: 9518
If I have a link I'm trying to preload, e.g.
<link rel="preload" href="http://example.com/example.js">
and I don't know if example.com
is an HTTP or HTTP2 server. Does the preload
specification do anything if it's only HTTP?
Upvotes: 1
Views: 233
Reputation: 46040
Yes preload can be used by both.
Some servers use the preload header to implement HTTP/2 push. See here for an explanation for Apache HTTP/2 push and here for how Cloudflare are doing this in a similar manner on a customised version of Nginx.
However there are also many use cases for using it outside of HTTP/2 by the browser. For example to preload fonts from other domains (HTTP/2 push obviously only works from your server) - that doesn't need HTTP/2 but just needs browser support - not great at the moment as basically just Chrome and Opera but WebKit (used by Safari) have just implemented it so should be rolled out soon enough though Mozilla/Firefox have not yet and neither have Microsoft/Edge.
Smashing Mag have a great article on this subject and why browser usage and HTTP/2 server usage complement each other and are useful for different use cases.
Upvotes: 2