IE10+ no longer supports browser detection tags to identify a browser.
For detecting IE10 I am using JavaScript and a capability-testing technique to detect certain ms
prefixed styles are defined such as msTouchAction
and msWrapFlow
.
I want to do the same for IE11, but I am assuming that all the IE10 styles will be supported in IE11 as well. Can anyone help me identify IE11 only styles or capabilities that I could use to tell the two apart?
Extra Info
- I don't want to use User Agent type detection because it's so spotty, and can be changed, as well as I think I've read that IE11 is intentionally trying to hide the fact it's Internet Explorer.
- For an example of how the IE10 capability testing works, I used this JsFiddle (not mine) as a basis for my testing.
- Also I am expecting a lot of answers of "This is a bad idea...". One of my needs for this is that IE10 claims it supports something, but it is very badly implemented, and I want to be able to differentiate between IE10 and IE11+ so I can move on with a capability-based detection method in the future.
- This test is coupled with a Modernizr test that will simply make some functionality "fallback" to less glamorous behavior. We are not talking about critical functionality.
ALSO I am already using Modernizr, but it doesn't help here. I need help for a solution to my clearly asked question please.
You can use js and add a class in html to maintain the standard of conditional comments:
Or use a lib like bowser:
https://github.com/ded/bowser
Or modernizr for feature detection:
http://modernizr.com/
Step back: why are you even trying to detect "internet explorer" rather than "my website needs to do X, does this browser support that feature? If so, good browser. If not, then I should warn the user".
You should hit up http://modernizr.com/ instead of continuing what you're doing.
If you're using Modernizr - then you can easily differntiate between IE10 and IE11.
IE10 doesn't support the
pointer-events
property. IE11 does. (caniuse)Now, based on the class which Modernizr inserts you could have the following CSS:
This seems to work:
https://www.limecanvas.com/css-hacks-for-targeting-ie-10-and-above/
This worked for me
And then in the css file things prefixed with
When is this browser ready to die?
In the light of the evolving thread, I have updated the below:
IE 6
or
IE 7
or
IE 6 and 7
or
or
IE 6, 7 and 8
IE 8
or
IE 8 Standards Mode Only
IE 8,9 and 10
IE 9 only
IE 9 and above
IE 9 and 10
IE 10 only
IE 10 and above
or
The use of
-ms-high-contrast
means that MS Edge will not be targeted, as Edge does not support-ms-high-contrast
.IE 11
Javascript alternatives
Modernizr
User agent selection
Javascript:
Adds (e.g) the below to
html
element:Allowing very targetted CSS selectors, e.g.:
Footnote
If possible, identify and fix any issue(s) without hacks. Support progressive enhancement and graceful degradation. However, this is an 'ideal world' scenario not always obtainable, as such- the above should help provide some good options.
Attribution / Essential Reading