While working with Web projects those required cross browser compatibility we often need to detect the browser type,like ie, Firefox Mozilla, or chrome...etc.
In this post we will see how to find ie browser. This is done using navigator object in JavaScript. Navigator has appName property that we can use to find ie browser.
JavaScript to detect ie
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<script type="text/javascript">
function getBrowserName()
{
if(navigator.appName=="Microsoft Internet Explorer") {
alert("This is " + navigator.appName + " Browser");
}
}
</script>
<body>
<form id="form1" runat="server">
<div>
<input type="button" onclick="return getBrowserName();" value="Get Browser Name"/>
</div>
</form>
</body>
</html>
//Above code will show alert message "This is Microsoft Internet Explorer Browser"
Here we will see how to detect IE browser using jQuery