diff options
author | jaubourg <j@ubourg.net> | 2011-01-09 16:50:13 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-01-09 16:50:13 +0100 |
commit | 5a5f67800b048ae274e644547f4b8e03156ffa49 (patch) | |
tree | c5280f8af99b42e0439aed4c36e5f9a6456745d4 /src | |
parent | c55a76a23fdf8e9b22d9792a0f3a39051cc33993 (diff) | |
download | jquery-5a5f67800b048ae274e644547f4b8e03156ffa49.tar.gz jquery-5a5f67800b048ae274e644547f4b8e03156ffa49.zip |
Fixes #5955. Option crossDomain now forces ajax to consider a request as cross-domain even when it is not. Useful for when servers issue redirects to cross-domain urls. Unit test added.
Diffstat (limited to 'src')
-rw-r--r-- | src/ajax.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ajax.js b/src/ajax.js index e910aa56f..eae20e459 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -520,12 +520,15 @@ jQuery.extend({ // Determine if a cross-domain request is in order var parts = rurl.exec( s.url.toLowerCase() ), loc = location; - s.crossDomain = !!( - parts && - ( parts[ 1 ] && parts[ 1 ] != loc.protocol || - parts[ 2 ] != loc.hostname || - ( parts[ 3 ] || 80 ) != ( loc.port || 80 ) ) - ); + + if ( ! s.crossDomain ) { + s.crossDomain = !!( + parts && + ( parts[ 1 ] && parts[ 1 ] != loc.protocol || + parts[ 2 ] != loc.hostname || + ( parts[ 3 ] || 80 ) != ( loc.port || 80 ) ) + ); + } // Convert data if not already a string if ( s.data && s.processData && typeof s.data != "string" ) { |