SCRIPT5: access denied in IE9 when downloading a file

When submitting a form with a file upload field using document.forms[0].submit() for 9, we get an error: SCRIPT5: Access is denied

If I click a few more times, it works great.

As work around, I caught a mistake and will try a few more times, which seems to work fine.

Is there any explanation for this? This code has worked on all other popular browsers for a long time.

The code also works fine in IE9 if the browser is set to IE9 compatibility mode, but that’s not what we have in common.

I saw XMLHTTP links that are the problem, and we make an XMLHTTP call, but this happens before the button to submit is clicked.

+7
source share
1 answer

It turns out that the security problem is related to the fact that we ran the file sending code in a pop-up window. The popup was opened using window.open with an empty string as the requested page. Then we sent the form to this window.

The problem is that the URL of the popup window defaults to: blank if not specified. Apparently, o: blank is considered unsafe, so when an attempt to return the POST file to the source domain appears, the message SCRIPT5: Access is denied appears.

The solution is to open a small html page stub type to open and then record. After selecting a file, the FILE message does not see an error, and the file does this as desired.

+11
source

All Articles