Protopop Posted February 16, 2014 Share Posted February 16, 2014 My site NimianLegends.com has not been thoroughly tested in Internet Explorer. So for the time being I detect Internet Explorer and redirect the user to another page using this method:if(window.ActiveXObject || "ActiveXObject" in window){ // Always true if browser is Internet Explorer window.location = 'pages/core/ie.htm';}Works flawlessly. Except.... Google's spiders must use activeX because on the Google results page it always shows the ie.htm page. Is there another simple, rock solid method to detect Internet Explorer in Javascript? Quote Link to comment Share on other sites More sharing options...
dhaber Posted February 16, 2014 Share Posted February 16, 2014 I'm not sure how rock solid it is these days, but I've always detected this by searching the navigator.userAgent for the string MSIE. For example:var isIE = (navigator.userAgent.indexOf("MSIE") != -1); Protopop 1 Quote Link to comment Share on other sites More sharing options...
Protopop Posted February 17, 2014 Author Share Posted February 17, 2014 Thanks dhaber. I've read that Microsoft intentionally broke this kind of detection in IE 11. BUT... Reading your suggestion it occurs to me that i can use this to detect earlier versions of IE before the change. The site works almost 100% in IE 11 so i could use your code to keep out IE 9 and below, which is really what I want to do. Thanks so much - sometimes marinating ideas and hearing suggestions helps come up with new views:) Quote Link to comment Share on other sites More sharing options...
enpu Posted February 17, 2014 Share Posted February 17, 2014 Yes MSIE is changed in IE 11. I use this: this.device.ie9 = /MSIE 9/i.test(navigator.userAgent); this.device.ie10 = /MSIE 10/i.test(navigator.userAgent); this.device.ie11 = /rv:11.0/i.test(navigator.userAgent); Quote Link to comment Share on other sites More sharing options...
Protopop Posted February 17, 2014 Author Share Posted February 17, 2014 Thanks enpu - i hadnt heard about that - it sounds very clean.For the moment ive used dhaber's suggestion. Worked great! since it doesnt work to detect IE11 that browser just passes through.If it's IE 10 (which is also detectable by the way you suggested) it catches it and sends it through.IE9 or less is refused:) var isIE10 = false;if (navigator.userAgent.indexOf("MSIE 10") > -1) { // this is internet explorer 10 isIE10 = true;}var isIE = (navigator.userAgent.indexOf("MSIE") != -1);if(isIE){ if(!isIE10){ window.location = 'pages/core/ie.htm'; }}; Quote Link to comment Share on other sites More sharing options...
clevercrow Posted June 10, 2014 Share Posted June 10, 2014 Is it safe to say that the open source Panda.js game "Flying Dog" simply won't work on IE? Thanks Quote Link to comment Share on other sites More sharing options...
enpu Posted June 15, 2014 Share Posted June 15, 2014 Working fine here on IE11. Quote Link to comment Share on other sites More sharing options...
Matt C. Wilson Posted October 9, 2014 Share Posted October 9, 2014 Works flawlessly. Except.... Google's spiders must use activeX because on the Google results page it always shows the ie.htm page. Is there another simple, rock solid method to detect Internet Explorer in Javascript? It sounds like your real issue isn't IE detection, it's robot / crawler prevention? Why not create a robots.txt with the following?User-agent: Googlebot Disallow: /pages/core/ie.htm From: http://tools.seobook.com/robots-txt/ Sir_Everard 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.