SCRIPT70: Permission denied Accessing iFrame in IE

后端 未结 1 774
野趣味
野趣味 2021-02-06 13:19

I am having some issues in IE with uploading files through a hidden iFrame. Actually the file upload is working fine but my jQuery code to display the success dialog and add the

相关标签:
1条回答
  • 2021-02-06 13:53

    I know this post is a bit old, but this may help future seekers for the mystery around IE.

    The solution proposed needs to be applied to the library of jQuery. The problem is explained here: https://connect.microsoft.com/IE/feedback/details/802251/script70-permission-denied-error-when-trying-to-access-old-document-from-reloaded-iframe

    and the solution is given here:

    https://github.com/jquery/sizzle/blob/5b3048605655285a81b06fbe4f49f2a14a8d790f/src/sizzle.js#L472-L480

    An alternative solution is located under this ticket at jQuery bug reporting site: http://bugs.jquery.com/ticket/14535 It is posted by user muley and a JSFiddle is provided as well: http://jsfiddle.net/xqb4s/

    The code that needs to be added in jQuery library in this case is:

    // MY EDIT - this try/catch seems to fix IE 'permission denied' errors as described here:
    // http://bugs.jquery.com/ticket/14535
    try{
        document === document; //may cause permission denied
    }
    catch(err){
        document = window.document; //resets document, and no more permission denied errors.
    } 
    

    Under the:

    function Sizzle( selector, context, results, seed )
    
    0 讨论(0)
提交回复
热议问题