Skip to content

Instantly share code, notes, and snippets.

Last active April 13, 2023 13:57
  • Star 36 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jakub-g/5fc11af85a061ca29cc84892f1059fec to your computer and use it in GitHub Desktop.
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>

Update September 2020: life's almost good. Edge Chromium is widely rolled out, and Safari 14.0 ships soon with a fix.

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
11-13.1 v module ✅⚠
79+ 60+ 61+ 14.0+ v module


  • ✅ no browser does double execution (provided the Safari hack)
  • ✅ modern Chrome, Edge, 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
    • This will apparently be fixed in Safari 14.0 (October 2020)
  • ❌ pre-2018 browsers do double fetches
  • ❌❌ Edge 17-18 does triple fetch (2x module + 1x nomodule). This about 80% of all Edge as of April 2020, but being phased out by Edge 80+.
Copy link

jakub-g commented Apr 27, 2020

Safari 13.1 is based on Webkit TP98 [0] was closed on 23 Jan 2020 which means it was not in TP99 (released 22 Jan 2020), it was probably shipped in TP100 (05 Feb 2020).

The bug fix is hence expected in Safari 14.0 in October 2020.


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