Skip to content

Commit e78b5da

Browse files
committed
Merge pull request #723 from AnalyticalGraphicsInc/fix_isCrossOriginUrl_in_ie
Fix isCrossOriginUrl in IE for real
2 parents 58fb2e2 + eb877f5 commit e78b5da

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Source/Core/isCrossOriginUrl.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ define(function() {
1414
a = document.createElement('a');
1515
}
1616

17-
var location = window.location;
17+
// copy window location into the anchor to get consistent results
18+
// when the port is default for the protocol (e.g. 80 for HTTP)
19+
a.href = window.location.href;
20+
21+
// host includes both hostname and port if the port is not standard
22+
var host = a.host;
23+
var protocol = a.protocol;
24+
1825
a.href = url;
1926
a.href = a.href; // IE only absolutizes href on get, not set
2027

21-
// host includes both hostname and port if the port is not standard
22-
return a.protocol !== location.protocol || a.host !== location.host;
28+
return protocol !== a.protocol || host !== a.host;
2329
};
2430

2531
return isCrossOriginUrl;

0 commit comments

Comments
 (0)