Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can we use SW module link in backward-compatible manner? #1186

Open
tzik opened this issue Aug 14, 2017 · 1 comment
Open

How can we use SW module link in backward-compatible manner? #1186

tzik opened this issue Aug 14, 2017 · 1 comment

Comments

@tzik
Copy link

tzik commented Aug 14, 2017

For JS files loaded by <script>, we can support both module-aware browsers and non-module-aware browsers as below:

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

Module-aware browsers load the first one, and non-module aware browsers load the second one by ignoring type="module" script and nomodule attribute.

Then, how about Link: headers and <link> tags with rel="serviceworker"?
IIUC, there is no similar trick to prevent old browsers from loading SW script link with workertype="module", or to disable classic SW on new browsers.

To achieve that, IMO, can we change rel="serviceworker" to rel="some-keyword-other-than-serviceworker-to-declare-serviceworker-module" for workertype="module", and add nomodule keyword to <link>?

@jakearchibald
Copy link
Contributor

If this is worth solving, we should solve it for link[rel=preload] too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants