Tom Tom - 4 months ago 7
HTML Question

How to redirect Internet Explorer users to a new page?

I have tried using the following script

[if IE]
<script type="text/javascript">
window.location = "error.html";
</script>
[endif]


It works like a treat apart from the fact that other browsers such as Chrome are also redirecting to the error.html page. What is wrong with it? Thanks

Answer

Try this:

<script type="text/javascript">
if(navigator.appName.indexOf("Internet Explorer")!=-1 || navigator.userAgent.match(/Trident.*rv[ :]*11\./))
{
   //This user uses Internet Explorer
   window.location = "error.html";
}
</script>

Greetings from Vienna