$window.location.origin
returns the wrong value on IE.
The origin property returns the protocol, hostname and port number of a URL.
<
You may also need the port number. If so, you can use this polyfill
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//"
+ window.location.hostname
+ (window.location.port ? ':' + window.location.port : '');
}
This polyfill is already part of Modernizr.
The problem (as usual) is IE that does not have window.location.origin
Instead try to use something like:
var root = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
Or you can add on top of your javascript this code so you don't have to bother about it
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
}