Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lekoala/nomodule-browser-warning.js
Display a warning message for browser not supporting js modules
https://github.com/lekoala/nomodule-browser-warning.js
browser module nomodule warning
Last synced: about 1 month ago
JSON representation
Display a warning message for browser not supporting js modules
- Host: GitHub
- URL: https://github.com/lekoala/nomodule-browser-warning.js
- Owner: lekoala
- License: mit
- Created: 2021-04-21T14:37:43.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-05-20T08:58:08.000Z (over 3 years ago)
- Last Synced: 2024-11-09T06:11:24.093Z (about 2 months ago)
- Topics: browser, module, nomodule, warning
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# nomodule-browser-warning.js
[![NPM](https://nodei.co/npm/nomodule-browser-warning.js.png?mini=true)](https://nodei.co/npm/nomodule-browser-warning.js/)
[![Downloads](https://img.shields.io/npm/dt/nomodule-browser-warning.js.svg)](https://www.npmjs.com/package/nomodule-browser-warning.js)## 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 ;-) ).```html
...
```
Or use with a cdn
```html
```
## How to configure
The script support the following data-attributes:
- data-text: The text displayed in the notification
- data-update-text: The label for the update button
- data-ignore-text: The label for the ignore button
- data-link: The link when you click on 'update' (https://browsehappy.com/ by default)
- data-cookie: Shoud we store ignore in a cookie? (true, by default)## How does it look ?
![screenshot](screenshot.png "screenshot")