From ce624d5382abcf7041e529fc271ec761d40a72e7 Mon Sep 17 00:00:00 2001 From: GetAway Date: Fri, 1 May 2015 22:15:14 +0200 Subject: [PATCH] yWeb: improve detection if IE up to IE11 and above --- src/nhttpd/web/Y_Baselib.js | 15 +++++++++++++-- src/nhttpd/web/Y_Tools_Cmd.yhtm | 4 +--- src/nhttpd/web/Y_Tools_Timer_Sync.js | 4 +--- src/nhttpd/web/Y_VLC.js | 10 +++++----- src/nhttpd/web/Y_Version.txt | 2 +- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/nhttpd/web/Y_Baselib.js b/src/nhttpd/web/Y_Baselib.js index a9c208648..fa4754711 100644 --- a/src/nhttpd/web/Y_Baselib.js +++ b/src/nhttpd/web/Y_Baselib.js @@ -3,8 +3,19 @@ $Revision$ */ var baselib_version="2.0.0"; -var agt=navigator.userAgent.toLowerCase(); -var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); +var tmp = document.documentMode, e, isIE; +// Try to force this property to be a string. +try{document.documentMode = "";} +catch(e){ }; +// If document.documentMode is a number, then it is a read-only property, and so +// we have IE 8+. +// Otherwise, if conditional compilation works, then we have IE < 11. +// Otherwise, we have a non-IE browser. +isIE = typeof document.documentMode == "number" || new Function("return/*@cc_on!@*/!1")( ); +// Switch back the value to be unobtrusive for non-IE browsers. +try{document.documentMode = tmp;} +catch(e){ }; + /*DHTML-Basics*/ function $yN(_obj_name) { diff --git a/src/nhttpd/web/Y_Tools_Cmd.yhtm b/src/nhttpd/web/Y_Tools_Cmd.yhtm index 5181c4303..5eea1491b 100644 --- a/src/nhttpd/web/Y_Tools_Cmd.yhtm +++ b/src/nhttpd/web/Y_Tools_Cmd.yhtm @@ -79,9 +79,7 @@ function doUpload()