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
Yet another simple (yet human readable) function to detect if the browser is IE or not (ignoring Edge, which isn't bad at all):
function isIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE '); // IE 10 or older
var trident = ua.indexOf('Trident/'); //IE 11
return (msie > 0 || trident > 0);
}