@@ -395,10 +395,23 @@ app.factory('$fileUploader', ['$compile', '$rootScope', '$http', '$window', func
395
395
} ) ;
396
396
397
397
iframe . bind ( 'load' , function ( ) {
398
- // fixed angular.contents() for iframes
399
- var html = iframe [ 0 ] . contentDocument . body . innerHTML ;
400
- var xhr = { response : html , status : 200 , dummy : true } ;
401
- var response = that . _transformResponse ( xhr . response ) ;
398
+ var response ;
399
+ var xhr = { response : response , status : 200 , dummy : true } ;
400
+ // Fix for legacy IE browsers that loads internal error page
401
+ // when failed WS response received. In consequence iframe
402
+ // content access denied error is thrown becouse trying to
403
+ // access cross domain page. When such thing occurs notifying
404
+ // with empty response object. See more info at:
405
+ // http://stackoverflow.com/questions/151362/access-is-denied-error-on-accessing-iframe-document-object
406
+ // Note that if non standard 4xx or 5xx error code returned
407
+ // from WS then response content can be accessed without error
408
+ // but 'XHR' status becomes 200. In order to avoid confusion
409
+ // returning response via same 'success' event handler.
410
+ try {
411
+ // fixed angular.contents() for iframes
412
+ xhr . response = iframe [ 0 ] . contentDocument . body . innerHTML ;
413
+ response = that . _transformResponse ( xhr . response ) ;
414
+ } catch ( e ) { }
402
415
that . trigger ( 'in:success' , xhr , item , response ) ;
403
416
that . trigger ( 'in:complete' , xhr , item , response ) ;
404
417
} ) ;
0 commit comments