Skip to content

Commit ecf65f0

Browse files
committed
Fix IE7 bug on isCrossDomain check
1 parent d0be832 commit ecf65f0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: vendor/assets/javascripts/jquery_ujs.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,14 @@
176176
// This is a workaround to a IE bug.
177177
urlAnchor.href = urlAnchor.href;
178178

179-
// Make sure that the browser parses the URL and that the protocols and hosts match.
180-
return !urlAnchor.protocol || !urlAnchor.host ||
181-
(originAnchor.protocol + "//" + originAnchor.host !==
182-
urlAnchor.protocol + "//" + urlAnchor.host);
179+
// If URL protocol is false or is a string containing a single colon
180+
// *and* host are false, assume it is not a cross-domain request
181+
// (should only be the case for IE7 and IE compatibility mode).
182+
// Otherwise, evaluate protocol and host of the URL against the origin
183+
// protocol and host
184+
return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) ||
185+
(originAnchor.protocol + "//" + originAnchor.host ===
186+
urlAnchor.protocol + "//" + urlAnchor.host)); //
183187
} catch (e) {
184188
// If there is an error parsing the URL, assume it is crossDomain.
185189
return true;

0 commit comments

Comments
 (0)