Bad Browser

Fork me on GitHubStarForkIssue

The library checks user's browser and then shows a warning if browser version doesn't fit minimal requirements.

npm i @dvhb/badbrowser
    

MIT License  ©  dvhb


import badbrowser from '@dvhb/badbrowser'

badbrowser.init({
    // path to your html alerts
    // could be a function:
    // function (ua) {
    //   return '/alerts/' + lang + '.html'
    // }
    path: '/alerts/en.html',
    // if `false` then user's choice will be saved in the cookies
    // and alert window will not be showen next time
    ignoreChoice: false,
    // Min version of browser that will be supported
    supported: {
        // user of chrome v.39 will see an alert window
        chrome: 42,
        firefox: 38,
        msie: 9,
        opera: 26,
        android: 10,
        safari: 6,
        // if `false`, will show alert for any mobile browser
        mobile: false
    }
})