Skip to content

Commit c776c85

Browse files
committed
Merge branch 'landing-3150' into upstream-master
2 parents 94494e3 + 4c44f69 commit c776c85

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

data/js/detect/os.js

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -945,14 +945,33 @@ window.os_detect.getVersion = function(){
945945
if (!ua_version) {
946946
// The ScriptEngine functions failed us, try some object detection
947947
if (document.documentElement && (typeof document.documentElement.style.maxHeight)!="undefined") {
948-
// IE8 detection straight from IEBlog. Thank you Microsoft.
948+
// IE 10 detection using nodeName
949949
try {
950-
ua_version = "8.0";
951-
document.documentElement.style.display = "table-cell";
952-
} catch(e) {
953-
// This executes in IE7,
954-
// but not IE8, regardless of mode
955-
ua_version = "7.0";
950+
var badNode = document.createElement && document.createElement("badname");
951+
if (badNode && badNode.nodeName === "BADNAME") { ua_version = "10.0"; }
952+
} catch(e) {}
953+
954+
// IE 9 detection based on a "Object doesn't support property or method" error
955+
if (!ua_version) {
956+
try {
957+
document.BADNAME();
958+
} catch(e) {
959+
if (e.message.indexOf("BADNAME") > 0) {
960+
ua_version = "9.0";
961+
}
962+
}
963+
}
964+
965+
// IE8 detection straight from IEBlog. Thank you Microsoft.
966+
if (!ua_version) {
967+
try {
968+
ua_version = "8.0";
969+
document.documentElement.style.display = "table-cell";
970+
} catch(e) {
971+
// This executes in IE7,
972+
// but not IE8, regardless of mode
973+
ua_version = "7.0";
974+
}
956975
}
957976
} else if (document.compatMode) {
958977
ua_version = "6.0";

0 commit comments

Comments
 (0)