I am setting up a simple browser checker that should pop up an alert on the user's browser if the browser is not "supported".
I set a global variable in application.haml
using a library called detect.js
:
:javascript
var ua = detect.parse(navigator.userAgent);
and I spit it out in the console to make sure it's catching the correct data and it is:
console.log(ua.browser.family);
and in base.coffee
I set up the conditional:
if ua.browser.family != 'Chrome' || 'Safari' || 'Firefox' || 'Chrome Canary'
alert('Your browser is not supported.')
Now, the alert will pop up on any browser, even if it is Chrome, Safari, Firefox, or Chrome Canary.
Looking for a second pair of eyes... What am I missing to get this to work properly?
It should read if ua.browser.family != 'Chrome' && ua.browser.family != 'Safari' && ua.browser.family != 'Firefox' && ua.browser.family != 'Chrome Canary'