Detect IE10 using JavaScript

Here are possible ways to detect IE10 browser using Javascript:

Though the following aren’t perfect solution it could be a better start.

Method 1:


var ie10 = (navigator.userAgent.match(/Trident\/[6]/i));

Method 2:


var ie10 = (navigator.userAgent.match(/MSIE 10/i));

Method 3:



<!doctype>
<html>
<head>
<!--[if (gt IE 9)]><script type="text/javascript">window.ie10 = true;</script> <![endif]-->
</head>
<body>

<script type=”text/javascript”>
if(window.ie10)
document.write(‘IE 10 detected.’);
else
document.write(‘Browser is NOT IE10.’);
</script>
</body>
</html>

Advertisements