Skip to content

Commit

Permalink
Fix IE7 bug on isCrossDomain check
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Sep 1, 2015
1 parent d0be832 commit ecf65f0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vendor/assets/javascripts/jquery_ujs.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,14 @@
// This is a workaround to a IE bug.
urlAnchor.href = urlAnchor.href;

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

0 comments on commit ecf65f0

Please sign in to comment.