diff --git a/WebContent/js/common-en.js b/WebContent/js/common-en.js index 0487b36..6a983ab 100644 --- a/WebContent/js/common-en.js +++ b/WebContent/js/common-en.js @@ -37,16 +37,14 @@ function isChromeBrowse() { } // find Context -function getContextName() -{ - // get context - var loc = location.href; - var sPos = loc.indexOf("/", 7) - var ePos = loc.indexOf("/", sPos+1) +function getContextName() { + // get context path from pathname (works with both http and https) + var pathname = location.pathname; + var pos = pathname.indexOf("/", 1); - if (ePos == -1) return "/"; - else return loc.substr(sPos, ePos-sPos + 1); -} + if (pos == -1) return pathname.endsWith("/") ? pathname : pathname + "/"; + else return pathname.substring(0, pos + 1); +} // return today : 20081231 function getToday() { diff --git a/WebContent/js/common-ko.js b/WebContent/js/common-ko.js index 8474645..59f170d 100644 --- a/WebContent/js/common-ko.js +++ b/WebContent/js/common-ko.js @@ -37,13 +37,12 @@ function isChromeBrowse() { // find Context function getContextName() { - // get context - var loc = location.href; - var sPos = loc.indexOf("/", 7) - var ePos = loc.indexOf("/", sPos + 1) + // get context path from pathname (works with both http and https) + var pathname = location.pathname; + var pos = pathname.indexOf("/", 1); - if (ePos == -1) return "/"; - else return loc.substr(sPos, ePos - sPos + 1); + if (pos == -1) return pathname.endsWith("/") ? pathname : pathname + "/"; + else return pathname.substring(0, pos + 1); } // return today : 20081231 diff --git a/WebContent/js/custom.js b/WebContent/js/custom.js index c71c8b0..e6bb511 100644 --- a/WebContent/js/custom.js +++ b/WebContent/js/custom.js @@ -149,7 +149,7 @@ jQuery.showModalDialog = function(options) { $().showModalDialog(options); }; var originalError = options.error; options.error = function(xhr, status, error) { if(xhr.status === 401) { - var location = getContextName() + '/'; + var location = getContextName(); comloadError(xhr, status, error, location); return; } diff --git a/WebContent/jsp/js/common-en.js b/WebContent/jsp/js/common-en.js index d5c846f..11a67eb 100644 --- a/WebContent/jsp/js/common-en.js +++ b/WebContent/jsp/js/common-en.js @@ -37,16 +37,14 @@ function isChromeBrowse() { } // find Context -function getContextName() -{ - // get context - var loc = location.href; - var sPos = loc.indexOf("/", 7) - var ePos = loc.indexOf("/", sPos+1) +function getContextName() { + // get context path from pathname (works with both http and https) + var pathname = location.pathname; + var pos = pathname.indexOf("/", 1); - if (ePos == -1) return "/"; - else return loc.substr(sPos, ePos-sPos + 1); -} + if (pos == -1) return pathname.endsWith("/") ? pathname : pathname + "/"; + else return pathname.substring(0, pos + 1); +} // return today : 20081231 function getToday() { diff --git a/WebContent/jsp/js/common-ko.js b/WebContent/jsp/js/common-ko.js index 1a2af10..ffdff43 100644 --- a/WebContent/jsp/js/common-ko.js +++ b/WebContent/jsp/js/common-ko.js @@ -37,15 +37,13 @@ function isChromeBrowse() { } // find Context -function getContextName() -{ - // get context - var loc = location.href; - var sPos = loc.indexOf("/", 7) - var ePos = loc.indexOf("/", sPos+1) +function getContextName() { + // get context path from pathname (works with both http and https) + var pathname = location.pathname; + var pos = pathname.indexOf("/", 1); - if (ePos == -1) return "/"; - else return loc.substr(sPos, ePos-sPos + 1); + if (pos == -1) return pathname.endsWith("/") ? pathname : pathname + "/"; + else return pathname.substring(0, pos + 1); } // return today : 20081231 function getToday()