Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning about unused preload despite it being used #10467

Closed
DanShappir opened this issue Mar 16, 2020 · 3 comments · Fixed by #10847
Closed

Warning about unused preload despite it being used #10467

DanShappir opened this issue Mar 16, 2020 · 3 comments · Fixed by #10847

Comments

@DanShappir
Copy link

When testing this Wix site: https://www.sova.health/
I get the following warning:

Warnings: A preload was found for "https://static.parastorage.com/unpkg/lodash@4.17.15/lodash.min.js" but was not used by the browser. Check that you are using the crossorigin attribute properly.

This resource is indeed preloaded using an instruction in the HTTP response header, but it's also loaded via a <script> tag from the same URL. Both have the same crossorigin policy: crossorigin="anonymous". And no warning is displayed in the Dev Tools Console.

This problem appears only in some Wix pages, despite all of them using this preload. Is this a problem in LH / PSI or am I missing something?

@patrickhulce
Copy link
Collaborator

Thanks for filing @DanShappir! It appears to be happening on this page because lodash is rerequested inside a subframe of that page (social-blog.wix.com), so while the original preload is being used correctly, the duplicate requested is triggering the warning logic.

We should tweak the warning to consider frames 👍

@DanShappir
Copy link
Author

Hi @patrickhulce thank you for the quick response! Just to make sure I understand: there is no unneeded or misconfigured preload on the main page. The problem is that the <script> tag in the iframe has a different crossorigin policy than the preload and <script> tag of the main frame. Is this correct?

Also, per my understanding, the fact that the <script> tag in the iframe has a different crossorigin, while not ideal, doesn't actually impact performance. This is because the iframe will take the resource from the disk cache regardless. (At least until Chrome implements double-keyed cache.) Is this also correct?

@patrickhulce
Copy link
Collaborator

there is no unneeded or misconfigured preload on the main page.

Correct.

The problem is that the <script> tag in the iframe has a different crossorigin policy than the preload and <script> tag of the main frame.

AFAIK, even if the preload crossorigin policy matches or the script isn't crossorigin at all, a preload still won't be reused across frames (example: https://melodic-class.glitch.me/frame-preload-top.html).

Also, per my understanding, the fact that the <script> tag in the iframe has a different crossorigin, while not ideal, doesn't actually impact performance.

Disk cache hits on a network request do have some minor performance impact compared to preload reuse, but in the grand scheme of things, you're right this has minimal impact.

FWIW, I believe double keyed cache has already been implemented, and it's just behind a flag for now :)(https://chromestatus.com/feature/5730772021411840), but yes the subsequent requests should be using the disk cache.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants