Detect if any kind of IE (MSIE) [duplicate]
This works for me to detect any Version of the IE 5-11 (Internet Explorer) (Aug/05/2014):
if (navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/)) || (typeof $.browser !== "undefined" && $.browser.msie == 1)){ alert("Please dont use IE.");}
This is because each release of Internet Explorer updates the user-agent string.
MSIE
tokens have been removed in Internet Explorer 11 and $.browser
uses navigator.userAgent
to determine the platform and it is removed in jQuery 1.9.
You can use following code to determine the browser with pure java-script.
var isIE = !!navigator.userAgent.match(/Trident/g) || !!navigator.userAgent.match(/MSIE/g);if(isIE){ alert("IE"); }else{ alert("Not IE"); }
Thanks!
if you are not interessted wich version of ie the user currently use you can try get it work with detecting if the browser supports the Conditional Compilation Statements
http://msdn.microsoft.com/en-us/library/7kx09ct1%28v=vs.80%29.aspx
if(/*@cc_on!@*/false){ // You use IE. That´s no good. alert("oh my god");}