MD5
e6df6e94fbf74cd10973f00d14109f9a
SHA1
d4aa9dde4724c873400f683b193611996cb14be9
  • User
  • Downloaded 557 times
  • Metalink
  • QR

Overall

Number of files: 1

Description

Stack Exchange Inbox Reputation and Badges

x Dismiss

up vote 3 down vote favorite

2

I am working on MVC application, .net 4.5 framework, VS 2010. I have a piece of Javascript code that identifies which browser the application is running. If the browser is Firefox then a particular block of code will be executed if not another block code will get executed. With IE 11 I am having a weird problem. The browser (ie 11) recognizes itself as Mozilla.

javascrip code :

if ($.browser.mozilla) { if (location.pathname == "/Stats/Reports") { // This is for local env. $("#prntCss").attr("href", "../../../Content/SitePrint_FF.css"); } else { $("#prntCss").attr("href", "../../Content/SitePrint_FF.css"); $("#rptPrntCss").attr("href", "../../Content/reportPrintStyles_FF.css"); }

enter image description here

javascript jquery asp.net-mvc mozilla internet-explorer-11

share|improve this question

 | 

up vote 12 down vote

Yes. IE 11 doesnt say it is IE anymore, it says it is Mozilla.

Althoug, all IE versions respond the word Trident (its layout engine) in all of its versions.

So something like this could work in your javascript

<script type="text/javascript"> CheckIE(); function CheckIE() { var Browser; Browser = navigator.userAgent; if (Browser.indexOf("Trident") == -1) { //WHATHEVER YOU WANT IF IT IS NOT INTERNET EXPLORER } } </script>

share|improve this answer

 | 

up vote 2 down vote

Yes, it does:

The compatible ("compatible") and browser ("MSIE") tokens have been removed.

...

These changes help prevent IE11 from being (incorrectly) identified as an earlier version.

Still there are some ways to detect it (search for "How to detect ie11"), but your best bet is to remove browser-detection code at all.

share|improve this answer

 | 

up vote 1 down vote

This is because IE 11 has a different style of user agent strings then previous versions of IE

http://msdn.microsoft.com/library/ms537503.aspx

User-Agent: Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko

share|improve this answer

 | 

up vote 1 down vote

Take a look at User agent string of IE 11: http://msdn.microsoft.com/en-us/library/ie/hh869301(v=vs.85).aspx

Now it says:

Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko

And more details: http://www.nczonline.net/blog/2013/07/02/internet-explorer-11-dont-call-me-ie/

I think that this is the reason.

share|improve this answer

 | 

default

List of files

Link: Code for blog or website: Link for forum: