Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#17649 closed defect (wontfix)

Make has('ie') work in IE > 10

Reported by: xMartin Owned by:
Priority: undecided Milestone: tbd
Component: Core Version: 1.9.2
Keywords: Cc:
Blocked By: Blocking:

Description

Currently has('ie') returns undefined for IE 11. I expect it to return 11.

I understand user agent sniffing is bad and discouraged. Additionally IE 11 removes document.all and stuff and thus is different then good old legacy IE.

Still, if the browser is an Internet Explorer of whatever version I expect has('ie') to return something other than undefined. Even if there's a check for the engine now (has('trident')).

Change History (5)

comment:1 Changed 5 years ago by dylan

Resolution: wontfix
Status: newclosed

This is by design (see #17311 for the details), as it is what Microsoft recommends toolkits and developers do for IE11. The short reason is that pretty much anything that would have been relevant for a blanket IE check in the past is no longer relevant for IE11, other than the product name.

comment:2 Changed 5 years ago by xMartin

I understand. But I don't like it.

First of all, 'ie' is short for Internet Explorer and if I use IE11 has('ie') is falsy which is plain wrong, thus confusing and error-prone.

Why not just replace all has('ie') occurences not checking for a version to has('ie') < 11? Easy change. And very explicit and self-explanatory. This is also a one-liner in an upgrade instruction.

I don't see how Microsoft recommends returning false for any IE check. This is just for legacy code that makes outdated assumptions based on these outdated checks.

I checked the Dojo code base and most has('ie') occurences check for a version number anyway. Those without sometimes assume IE10 is the latest version. These need to be updated anyway, in case things changed in IE11. I also expect some code branches following has('ie') checks without version number to not be necessary for IE9 or IE10 but they work and haven't been updated.

I don't really see the value of something returning if I'm on an Internet Explorer littler or equal version 10. IE10 is pretty standards-compliant with a precise rendering engine and without memory leaks and all, no? IE11 is not the first IE that supports recent standards it just removes legacy APIs.

Let's make things more clear and explicit.

comment:3 Changed 5 years ago by xMartin

Additionally I think code readability is really important. If you mean something like has('ie') <= 10 or even has('ms-legacy-apis-like-attachevent') but write has('ie') that is not really readable and needs explanation.

And one more: If you have some code that shows you the respective icon of the browser you use or a download link for a fitting browser plugin you're lost. That would need a combination of 'ie' and 'trident' but you'd actually care for the product not the engine.

comment:4 Changed 5 years ago by xMartin

Additionally I think code readability is really important. If you mean something like has('ie') <= 10 or even has('ms-legacy-apis-like-attachevent') but write has('ie') that is not really readable and needs explanation.

And one more: If you have some code that shows you the respective icon of the browser you use or a download link for a fitting browser plugin you're lost. That would need a combination of 'ie' and 'trident' but you'd actually care for the product not the engine.

Version 0, edited 5 years ago by xMartin (next)

comment:5 Changed 5 years ago by dylan

I understand your perspective, but Microsoft the vendor has specifically requested this. Nothing too surprising with what they are saying, but surprising that they ask you to not identify IE as IE by removing MSIE from the user agent string, and returning false for checks for things like document.all.

See http://msdn.microsoft.com/en-us/library/ie/bg182625%28v=vs.85%29.aspx

    The compatible ("compatible") and browser ("MSIE") tokens have been removed.
    The "like Gecko" token has been added (for consistency with other browsers).
    The version of the browser is now reported by a new revision ("rv") token.

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

In general, you should avoid detecting specific browsers or browser versions. The 
assumptions underlying such tests tend to lead to false positive results when 
browsers are updated. Instead, detect features as you need them and use 
progressive enhancement to provide simplified experiences for browsers or devices 
that do not support the features you need.

In rare cases, it may be necessary to uniquely identify IE11. Use the Trident 
token to do so.

As far as code readability of some of our internal tests and checks, I'm not completely happy with that either.

Regarding any checks for IE where you say that "Those without sometimes assume IE10 is the latest version." I believe we have resolved all of those in 1.9.2, but if you know of any where we have not, please let us know.

Note: See TracTickets for help on using tickets.