diff options
author | Jonathan Bennett <jbennett@incomsystems.biz> | 2016-04-11 13:01:28 -0500 |
---|---|---|
committer | Jonathan Bennett <jbennett@incomsystems.biz> | 2016-04-12 11:00:28 -0500 |
commit | c8294760b12fe5231e0c56b8ed1dc88d29668d57 (patch) | |
tree | 0023bee561c606e861b86b4f3d899ca0904afe0a | |
parent | b403cb92fb8de82d04f305b4f14fa978003890d7 (diff) | |
download | novnc-c8294760b12fe5231e0c56b8ed1dc88d29668d57.tar.gz |
Handle missing leading slash in elem.pathname
IE11 with compat mode turned off has been observed displaying this behavior. This commit checks for and corrects this broken behavior.
Fixes #591
-rw-r--r-- | include/webutil.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/webutil.js b/include/webutil.js index 4289aa6..abb180a 100644 --- a/include/webutil.js +++ b/include/webutil.js @@ -282,5 +282,10 @@ WebUtil.injectParamIfMissing = function (path, param, value) { elem.search = "?" + query.join("&"); } - return elem.pathname.slice(1) + elem.search + elem.hash; + // some browsers (e.g. IE11) may occasionally omit the leading slash + // in the elem.pathname string. Handle that case gracefully. + if (elem.pathname.charAt(0) == "/") { + return elem.pathname.slice(1) + elem.search + elem.hash; + } else { + return elem.pathname + elem.search + elem.hash; }; |