I am calling a function like the one below by click on divs with a certain class.
Is there a way I can check when starting the function if a user is using Internet
function msieversion() {
var ua = window.navigator.userAgent;
console.log(ua);
var msie = ua.indexOf("MSIE ");
if (msie > -1 || navigator.userAgent.match(/Trident.*rv:11\./)) {
// If Internet Explorer, return version numbe
// You can do what you want only in IE in here.
var version_number=parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)));
if (isNaN(version_number)) {
var rv_index=ua.indexOf("rv:");
version_number=parseInt(ua.substring(rv_index+3,ua.indexOf(".",rv_index)));
}
console.log(version_number);
} else {
//other browser
console.log('otherbrowser');
}
}
You should see the result in console, please use chrome Inspect.