how can I make it so that if the user is not using any version of Internet Explorer to alert them and advise them to use it?
I've tried:
<html>
<head>
<script language="Javascript">
<![if !IE]>
alert ("Please use IE")
<![endif]>
</script>
</head>
Thanks
how can I make it so that if the user is not using any version of Internet Explorer to alert them and advise them to use it?
I've tried:
<html>
<head>
<script language="Javascript">
<![if !IE]>
alert ("Please use IE")
<![endif]>
</script>
</head>
Thanks
Share Improve this question asked Feb 13, 2013 at 2:02 KoalaKoala 5,5434 gold badges26 silver badges34 bronze badges 3- 13 Wait.. you want your users to use IE? – Piccolo Commented Feb 13, 2013 at 2:04
- 1 Perhaps the OP works for Microsoft... – Lee Taylor Commented Feb 13, 2013 at 2:05
- 1 stackoverflow./questions/4169160/… – Matt Commented Feb 13, 2013 at 2:05
2 Answers
Reset to default 3You can use:
if (navigator.appName != "Microsoft Internet Explorer")
{
alert("Please use IE");
}
OR:
if (navigator.userAgent.indexOf("MSIE") == -1)
{
alert("Please use IE");
}
FYI, you could also use the examples below but Conditional Comments are REMOVED from Internet Explorer 10.
Otherwise you could use:
<!--[if !IE]><!-->
<script type="text/javascript">
alert("Please use IE");
</script>
<!--<![endif]-->
OR this:
<!--[if IE]><script type="text/javascript">window['isIE'] = true;</script><![endif]-->
<script type="text/javascript">
if (!window.isIE) alert("Please use IE");
</script>
But still; to get this functionality in IE10; there is a workaround, which is opting into IE 9 behaviour via this meta tag:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
If you're using jQuery you can do:
if (!$.browser.msie) {
alert( "Please Use IE" );
}