Home

Awesome

nomodule-browser-warning.js

NPM Downloads

How to use

Simple include the following script in your head. It will be ignored by browser supporting the module attribute.

Since js modules are supported by most browsers since 2018, showing this warning is a good way to run your javascript on modern browsers without having to rely on polyfills or transpiling.

The best thing in this is that it will have NO impact on performance on modern browsers that will simply ignore this line (and therefore keep your lighthouse results up ;-) ).

<head>
...
<script src="/js/nomodule-browser-warning.js" nomodule defer id="nomodule-browser-warning"></script>
</head>

Or use with a cdn

<head>
<script src="https://cdn.jsdelivr.net/gh/lekoala/nomodule-browser-warning.js/nomodule-browser-warning.min.js" nomodule defer id="nomodule-browser-warning"></script>
</head>

How to configure

The script support the following data-attributes:

How does it look ?

screenshot