diff options
author | John Resig <jeresig@gmail.com> | 2007-12-14 02:04:00 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-12-14 02:04:00 +0000 |
commit | 56a93fc2cce999ccfb0e3b80aeaa0f480ef7ae6e (patch) | |
tree | 259de4970f57f35706a1b2db6f3150955958d257 /src | |
parent | 14a3a5bf9d65d9910a730d53208e3dccb34e3704 (diff) | |
download | jquery-56a93fc2cce999ccfb0e3b80aeaa0f480ef7ae6e.tar.gz jquery-56a93fc2cce999ccfb0e3b80aeaa0f480ef7ae6e.zip |
Added an extra try block to handle FF 3 x-domain requests. (Bug #1557)
Diffstat (limited to 'src')
-rw-r--r-- | src/ajax.js | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/ajax.js b/src/ajax.js index 35995f6b6..80cabd32d 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -255,17 +255,20 @@ jQuery.extend({ // Open the socket xml.open(s.type, s.url, s.async); - // Set the correct header, if data is being sent - if ( s.data ) - xml.setRequestHeader("Content-Type", s.contentType); + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + // Set the correct header, if data is being sent + if ( s.data ) + xml.setRequestHeader("Content-Type", s.contentType); - // Set the If-Modified-Since header, if ifModified mode. - if ( s.ifModified ) - xml.setRequestHeader("If-Modified-Since", - jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); + // Set the If-Modified-Since header, if ifModified mode. + if ( s.ifModified ) + xml.setRequestHeader("If-Modified-Since", + jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); - // Set header so the called script knows that it's an XMLHttpRequest - xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + // Set header so the called script knows that it's an XMLHttpRequest + xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + } catch(e){} // Allow custom headers/mimetypes if ( s.beforeSend ) |