From 09c7591f609cd31c4a1edc5fe45b78338e19d2e9 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 5 Jan 2015 19:14:50 +0100 Subject: [PATCH] luci2: polyfill window.location.origin Signed-off-by: Jo-Philipp Wich --- luci2/htdocs/luci2/luci2.js | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.11.0