Link rel="preload" not working for assets loaded within iframe

18 views Asked by At

I have a page with a same-origin iframe. I know that iframe is going to need some CSS/JS assets so I issue Link headers to preload them from the page that contains the iframe.

Example of the header:

Link: </build/esm/editor.js>; rel="preload"; as="script"

In the Chrome dev tools console I get the following warning for each asset:

The resource https://example.dev/build/esm/editor.js 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.

When I look at the iframe the asset URL matches exactly the URL in the header and the JS console.

In Firefox no warning appears in the console. In both Chrome and FF I can see that the asset is requested twice.

I've also tried issuing the Link headers in the request for the iframe content but that doesn't work either.

0

There are 0 answers