Skip to content

Commit

Permalink
Merge pull request #723 from AnalyticalGraphicsInc/fix_isCrossOriginU…
Browse files Browse the repository at this point in the history
…rl_in_ie

Fix isCrossOriginUrl in IE for real
  • Loading branch information
mramato committed Apr 30, 2013
2 parents 58fb2e2 + eb877f5 commit e78b5da
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/Core/isCrossOriginUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ define(function() {
a = document.createElement('a');
}

var location = window.location;
// copy window location into the anchor to get consistent results
// when the port is default for the protocol (e.g. 80 for HTTP)
a.href = window.location.href;

// host includes both hostname and port if the port is not standard
var host = a.host;
var protocol = a.protocol;

a.href = url;
a.href = a.href; // IE only absolutizes href on get, not set

// host includes both hostname and port if the port is not standard
return a.protocol !== location.protocol || a.host !== location.host;
return protocol !== a.protocol || host !== a.host;
};

return isCrossOriginUrl;
Expand Down

0 comments on commit e78b5da

Please sign in to comment.