What is link rel="subresource" used for? What difference would that make if I use link rel="subresource" instead of link rel="text/javascript" for including .JS files?
Chrome is going to remove <link rel=subresource>
because it is not useful, proprietary, and buggy.
See https://crbug.com/581840
Removed in Chrome 50 https://www.chromestatus.com/feature/6596598008119296
Use <link rel=preload>
instead.
https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content
As of 2016 the subresource
value for the rel
attribute was deprecated and removed.
It has been superseded by the Preload API instead, meaning one should do rel=preload
for a similar effect. To quote the specs
The
preload
keyword on link elements provides a declarative fetch primitive that initiates an early fetch and separates fetching from resource execution.As such, the
preload
keyword serves as a low-level primitive that enables applications to build custom resource loading and execution behaviors without hiding resources from the user agent and incurring delayed resource fetching penalties.For example, the application can use the
preload
keyword to initiate early, high-priority, and non-render-blocking fetch of a CSS resource that can then be applied by the application at appropriate time.
Below is the original answer written in 2015, for posterity, that explains the then valid subresource
keyword.
The rel=subresource
link is what is called Link prefetching, where the browser tries to fetch the resource before it's needed, so it can load that resource faster from cache when it is in fact needed later on.
Link prefetching is a browser mechanism to download or prefetch resources.
Link prefetching is a browser mechanism, which utilizes browser idle time to download or prefetch documents that the user might visit in the near future. A web page provides a set of prefetching hints to the browser, and after the browser is finished loading the page, it begins silently prefetching specified documents and stores them in its cache. When the user visits one of the prefetched documents, it can be served up quickly out of the browser's cache.
The server provides hints to the browser and the browser can consult its cache and take action based on these hints.
The existing link prefetching uses a standard HTTP link header, and defines semantics for the link relation type "prefetch".
link rel=subresource
provides a new link relation type with different semantics from link rel=prefetch
.
While rel=prefetch
provides a low-priority download of resources to be used on subsequent pages, rel=subresource
enables early loading of resources within the current page. Because the resource is intended for use within the current page, it must be loaded at high priority in order to be useful.
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