Is IE? Shortest JavaScript code to find whether the browser is Internet Explorer.

January 30th, 2009 by Sunil

There are a lot of JavaScript codes to find whether the user browser is Internet Explorer. But here is the shortest code to check whether the browser is Internet Explorer.

if(‘\v’==’v')

It will return true if you are using Internet Explorer.

So we can write the code like this.

1
2
3
4
5
6
7
8
<script type="text/javascript">
if("\v"=="v"){
	alert("This browser is Internet Explorer");
}
else{
	alert("This browser is not Internet Explorer");
}
</script>