I am searching for an object detection capability check which will identify IE9. Can you help me?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Use the properties of the IE window object introduced in each release to distinguish IE versions:
IE >= 7:
("onpropertychange" in document) && (!!window.XMLHttpRequest)
IE >= 8:
("onpropertychange" in document) && (!!window.XDomainRequest)
IE >= 9:
("onpropertychange" in document) && (!!window.innerWidth)
IE >= 10:
("onpropertychange" in document) && (!!window.matchMedia)
IE >= 11:
(!!window.msMatchMedia) && (!window.doScroll)
Check out this snippet by James Padolsey:
Afterwards, you could use it like this:
The good thing here is that it doesn’t sniff the UA string (which, in itself, is unreliable) — instead, it uses conditional comments, which work reliably in IE.
This can be used to detect IE5—9.
Not 100% sure this is what you're asking, but if you want to detect information about the browser of the visitor you can do check
navigator.appVersion
Example: