I'm trying to make a Script that will detect if you have Chrome, and then do some code, if not, do other code. I'm using DetectJS to detect the browsers, this is my code right now:
const ua = detect.parse(navigator.userAgent);
function nameContinue() {
if (ua.browser.family == "Chrome") {
console.log("browser (" + ua.browser.family + ") is supported");
//Do some code
} else {
console.log("browser (" + ua.browser.family + ") is not supported");
//Do some other code
}
}
<button onClick="nameContinue()">Click me to run code</button>
<script src="https://vendor.scribblenerd.com/detectjs-1.0.0-dist/js/detect.min.js"></script>
<script src="js/form.js"></script>
It works fine when I test it on Firefox, but in Safari, and Mobile Safari, the console prints out
browser (Safari) is supported
even though it should be saying that its not supported in console... any ideas?