function whereUWantToDetectBrowser(){
if (navigator.appName == "Microsoft Internet Explorer")
intExp();
else
other();
}
function intExp(){
//do what you want to do for specifically Internet Explorer
}
function other(){
//do what you want to do for other browsers
}
this code solves the problem. Instead of calling functions from whereUWantToDetectBrowser()
, if you write your specific code there, this will cause an error. And code will not run. Because a browser detects the code which it has to run (specific to each browser). and if you are distinguishing the code means the code is not working in some browsers, so you want to write it specifically for those browsers.
So, other()
will have not effect in IE, as intExp()
has no effect in other browsers.