Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Will it double-fetch? Browser behavior with `module` / `nomodule` scripts

Testing double-fetching of module/nomodule JS code (including the Safari hack)

<script type="module" src="module.js"></script>
<script nomodule src="nomodule.js"></script>

Test page:

IE/Edge Firefox Chrome Safari fetches module fetches nomodule executes
15- 59- 55- 10.0- v v nomodule
16 10.1/3 v v module
17-18 double! v module
56-60 v nomodule
60+ 61+ 11.0+* v module


  • no browser does double execution (provided the Safari hack)
  • modern Chrome and Firefox never fetch more than necessary
  • ⚠ Safari <11 may or may not double fetch (even with the hack); it does not on small test pages, but in real complex pages it does (it seems deterministic, but not clear what's the exact trigger)
  • ⚠ Safari 11+ may still double fetch in some cases (see
  • pre-2018 browsers do double fetches
  • latest Edge does triple fetch (2x module + 1x nomodule)

This comment has been minimized.

Copy link

AndrewGibson27 commented Jan 23, 2020

Webkit has patched the Safari 11+ double-fetch bug:


This comment has been minimized.

Copy link
Owner Author

jakub-g commented Jan 31, 2020

👍 thx for the comment @AndrewGibson27. Hopefully this makes it into Safari 13.1 (for now it's in Technical Preview only)


This comment has been minimized.

Copy link

indexzero commented Feb 7, 2020

Was your PR to caniuse (awesome btw – super helpful for me) supposed to show green for Safari 11-13 @jakub-g? Based on the Webkit comment above it seems like caniuse for es6 modules should be showing Yellow:

Screen Shot 2020-02-07 at 6 01 00 AM

My gut is saying regression in caniuse, but I wanted surface it your way since it was your contribution originally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.