Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/rails.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,17 @@

// Determines if the request is a cross domain request.
isCrossDomain: function(url) {
var regexp = new RegExp('^\\s*(?:[a-z]+:)?//', 'i');
if(!regexp.test(url)) {
return false;
}

var originAnchor = document.createElement('a');
originAnchor.href = location.href;
var urlAnchor = document.createElement('a');

try {
urlAnchor.href = url;
// 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 ||
Expand Down