A library that detects browser compatibility and prompts website users to upgrade it.
A library that detects browser compatibility and prompts website users to upgrade it.
#### Via NPM
``sh`
$ npm i -D obsolete-web
#### Via CDN
`html`
`js`
new Obsolete().test(['ie 10', 'chrome 23'])
#### Syntax
> new Obsolete([options])
#### Parameters
- optionsoptions.template
- type: string The prompt html template injected to the bottom of body. The default value is:`
js`
'Your browser is not supported. '
options.position
- type: string default: 'afterbegin' If set 'afterbegin', the template will be injected into the start of body. If set 'beforeend', the template will be injected into the end of body.options.promptOnNonTargetBrowser
- type: boolean default: false If the current browser useragent doesn't match one of the target browsers, it's considered as unsupported. Thus, the prompt will be shown. E.g, your browserslist configuration is ie > 8, by default, the prompt won't be shown on Chrome or Safari browser.options.promptOnUnknownBrowser
- type: boolean default: true If the current browser useragent is unknown, the prompt will be shown.
#### Syntax
> test(browsers, done)
Test browser compatibility.
#### Parameters
- browsers {string[]} Browser names in Can I Use.done
- {function} Callback when the template is injected in finish.
#### Returns
{boolean}`