I am searching for an object detection capability check which will identify IE9. Can you help me?
Internet Explorer 9 Object Detection
1.7k views Asked by FURKAN ILGIN At
3
There are 3 answers
0
On
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:
<div id="example"></div>
<script type="text/javascript">
txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt+= "<p>Browser Name: " + navigator.appName + "</p>";
txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";
document.getElementById("example").innerHTML=txt;
</script>
0
On
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.