0.5.6 • Published 7 years ago
obsolete-web v0.5.6
Obsolete Web ·

A library that detects browser compatibility and prompts website users to upgrade it.
Getting Started
Installation
Via NPM
$ npm i -D obsolete-webVia CDN
<!-- minify version -->
<script src="//unpkg.com/obsolete-web/dist/obsolete.min.js"></script>
<!-- unminify version -->
<script src="//unpkg.com/obsolete-web/dist/obsolete.js"></script>Basic Usage
new Obsolete().test(['ie 10', 'chrome 23'])API
Constructor
Syntax
new Obsolete(options)
Parameters
optionsoptions.templatetype:stringThe prompt html template injected to the bottom of body. The default value is:'<div>Your browser is not supported. <button id="obsoleteClose">×</button></div>'options.positiontype:stringdefault:'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.promptOnNonTargetBrowsertype:booleandefault:falseIf 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 isie > 8, by default, the prompt won't be shown on Chrome or Safari browser.options.promptOnUnknownBrowsertype:booleandefault:trueIf the current browser useragent is unknown, the prompt will be shown.
Methods
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}