Skip to content

Commit b178346

Browse files
committed
fix(iframe): fix handling of res:// error for <=IE9 to have the possibility to handle it from within the client app
1 parent 759e5e9 commit b178346

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/module.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ module
493493
var iframe = angular.element('<iframe name="iframeTransport' + Date.now() + '">');
494494
var input = item._input;
495495
var that = this;
496+
var html;
497+
var responseStatus = 200;
496498

497499
if (item._form) item._form.replaceWith(input); // remove old form
498500
item._form = form; // save link to new form
@@ -529,10 +531,14 @@ module
529531
// returning response via same 'success' event handler.
530532

531533
// fixed angular.contents() for iframes
532-
var html = iframe[0].contentDocument.body.innerHTML;
533-
} catch (e) {}
534+
html = iframe[0].contentDocument.body.innerHTML;
535+
} catch (e) {
536+
// in case we run into the access-is-denied error or we have another error on the server side
537+
// (intentional 500,40... errors), we at least say 'something went wrong' -> 500
538+
responseStatus = 500;
539+
}
534540

535-
var xhr = {response: html, status: 200, dummy: true};
541+
var xhr = {response: html, status: responseStatus, dummy: true};
536542
var response = that._transformResponse(xhr.response);
537543
var headers = {};
538544

0 commit comments

Comments
 (0)