NEW268370
curlconverter.com: fetch API does not use the result of <link rel=preload>
https://bugs.webkit.org/show_bug.cgi?id=268370
Summary curlconverter.com: fetch API does not use the result of <link rel=preload>
Boris
Reported 2024-01-30 02:46:36 PST
Created attachment 469615 [details] a screenshot of the Network dev tools tab showing that other-file.txt is loaded twice I created these 3 files: index.html <!DOCTYPE html> <html lang="en"> <head> <link rel="preload" href="/other-file.txt" type="text/plain" as="fetch" crossorigin=""> <title>test fetch preload</title> </head> <body> <script src="/main.js"></script> </body> </html> main.js fetch('/other-file.txt') other-file.txt hello world Then I served them with `python -m http.server` and opened localhost:8000 in Safari 17. What I expected: main.js and other-file.txt would be loaded at the same time Actual: main.js and other-file.txt are indeed loaded at the exact same time, but then other-file.txt is loaded a second time after main.js and a few seconds later the console prints a warning that "The resource http://localhost:8000/other-file.txt was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing." This works correctly (as I expect) on both Chrome and Firefox.
Attachments
a screenshot of the Network dev tools tab showing that other-file.txt is loaded twice (84.18 KB, image/png)
2024-01-30 02:46 PST, Boris
no flags
Radar WebKit Bug Importer
Comment 1 2024-02-06 02:47:14 PST
Boris
Comment 2 2025-08-21 22:34:44 PDT
Would be nice if this was fixed.
Karl Dubost
Comment 3 2025-08-22 05:29:11 PDT
Boris, Does it affect one of your live websites? Or a website you know about? Thanks for the report.
Boris
Comment 4 2025-08-22 06:31:12 PDT
Yes, it makes http://curlconverter.com/ take 30%+ longer to load than Chrome. https://github.com/curlconverter/curlconverter/blob/73e61e568d85aff311cb30612b3b60af91f5ef8b/src/shell/webParser.ts#L7 https://github.com/tree-sitter/tree-sitter/blob/be888a5fef7688a68d8fbe4d5124a2c03a39d9b4/lib/binding_web/src/language.ts#L267 This is a problem for anyone that uses Wasm and wants to make their site load faster using less roundtrips since Wasm basically has to be loaded using fetch(). You can also search httparchive or commoncrawl for the string 'as="fetch"' in the HTML to get a full list of sites affected.
Karl Dubost
Comment 5 2025-08-24 18:57:16 PDT
Thanks a lot. That helps.
Note You need to log in before you can comment on or make changes to this bug.