summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-01-05 19:14:50 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-05 19:14:50 +0100
commit09c7591f609cd31c4a1edc5fe45b78338e19d2e9 (patch)
tree12e0cb76df66c5b84113e1d2266053926c57a721
parent6594e53c252c64243c039891c2c0d8afdd25f782 (diff)
downloadluci2-ui-09c7591f609cd31c4a1edc5fe45b78338e19d2e9.tar.gz
luci2: polyfill window.location.origin
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--luci2/htdocs/luci2/luci2.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/luci2/htdocs/luci2/luci2.js b/luci2/htdocs/luci2/luci2.js
index 040f1e5..284f880 100644
--- a/luci2/htdocs/luci2/luci2.js
+++ b/luci2/htdocs/luci2/luci2.js
@@ -173,6 +173,13 @@ String.prototype.format = function()
return out + str;
}
+if (!window.location.origin)
+ window.location.origin = '%s//%s%s'.format(
+ window.location.protocol,
+ window.location.hostname,
+ (window.location.port ? ':' + window.location.port : '')
+ );
+
function LuCI2()
{
var L = this;