Skip to content

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

@tzik

Description

@tzik

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>?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions