mirror of
https://github.com/jquery/jquery.git
synced 2026-02-05 20:45:02 -05:00
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.
This commit is contained in:
15
src/ajax.js
15
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" ) {
|
||||
|
||||
Reference in New Issue
Block a user