Skip to content

Commit

Permalink
Unified cross-domain response as undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueimp committed Jun 29, 2011
1 parent e59d11c commit 046dd90
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions jquery.iframe-transport.js
@@ -1,5 +1,5 @@
/*
* jQuery Iframe Transport Plugin 1.2.1
* jQuery Iframe Transport Plugin 1.2.2
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011, Sebastian Tschan
Expand Down Expand Up @@ -50,8 +50,14 @@
// when trying to access cross-domain iframe contents:
try {
response = iframe.contents();
// Google Chrome and Firefox do not throw an
// exception when calling iframe.contents() on
// cross-domain requests, so we unify the response:
if (!response.length || !response[0].firstChild) {
throw new Error();
}
} catch (e) {
response = $();
response = undefined;
}
// The complete callback returns the
// iframe content document as response object:
Expand Down

0 comments on commit 046dd90

Please sign in to comment.