diff --git a/src/_h5ai/js/inc/model/entry.js b/src/_h5ai/js/inc/model/entry.js index 5bc31760..da6889b4 100644 --- a/src/_h5ai/js/inc/model/entry.js +++ b/src/_h5ai/js/inc/model/entry.js @@ -1,11 +1,12 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, types, ajax) { - var domain = document.domain, + var doc = document, + domain = doc.domain, location = (function () { var testpathname = '/a b', - a = document.createElement('a'), + a = doc.createElement('a'), isDecoded, location; a.href = testpathname; @@ -18,6 +19,10 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty location = encodeURIComponent(location).replace(/%2F/ig, '/').replace(/'/g, '%27'); } + if (!location) { + location = doc.location.href.replace(/.*:\/\/[^\/]*/, '').replace(/[^\/]*$/, ''); + } + return location; }()),