[Webkit-unassigned] [Bug 236009] preload as=fetch loads json resource again during javascript fetch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 3 13:23:34 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=236009

--- Comment #5 from tobias at tangemann.org ---
Hi, I'm not sure how the behavior was in the past but I just found this post:
https://stackoverflow.com/questions/52635660/can-link-rel-preload-be-made-to-work-with-fetch/63814972#63814972

Due to one comment it might have already been this way since Safari 12.0.3

I can confirm that the posted solution works across browsers.

    <link rel="preload" as="fetch" href="/data.json">
combined with: 
    fetch('/data.json', {
        method: 'GET',
        credentials: 'include',
        mode: 'no-cors',
    })

This solves my problem in this case.

I'm no expert on the correct behavior given the original posted combinations of fetch options and usage of the crossorigin attribute.
Also the standard resources seem to not cover this case clearly:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload#cors-enabled_fetches
https://w3c.github.io/preload/

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220203/83887f42/attachment.htm>


More information about the webkit-unassigned mailing list