If a module script receives a non-JS MIME type, it doesn't execute.
Module scripts default to the anonymous
CORS attribute.
The crossorigin
attribute is not allowed/respected for module scripts.
There is no syntax in JavaScript for propagating CORS attributes.
Applications that wish to authenticate modules can do so with fetch
and ServiceWorker
, but must take care to censor secrets from function bodies. It is recommended practice that unencrypted secrets should not be kept in source code but in separate files.
Change to the HTML fetch semantics: if (a) a request is anonymous and (b) its response has a JS MIME type, then the response is non-opaque.
When a module script's response is opaque, it still executes.