luci2: polyfill window.location.origin
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 5 Jan 2015 18:14:50 +0000 (19:14 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 5 Jan 2015 18:14:50 +0000 (19:14 +0100)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
luci2/htdocs/luci2/luci2.js

index 040f1e5..284f880 100644 (file)
@@ -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;