开发者

SCRIPT5: Access is denied in IE9 on file upload

When posting a form with a file upload box using document.forms[0].submit() on ie 9 we get an error that says: SCRIPT5: Access is denied

If I click a few more times it works fine.

As a work around I've caught the error and try a few more times which seems to work just fine.

Is there any explanation on this? The code has worked for years on all the other popular browsers.

The code also works fine in IE9 if the browser is set to IE9 compatibility mode, but that is not something we have general control over.

I've seen references to XMLHTTP being an issue and we do execute a XMLHTTP call but it happens before the button to sub开发者_运维知识库mit is clicked.


It turns out that the security issue is due to the fact that we were running the file submit code in a pop up window. The pop up window was opened with window.open which had an empty string as the requested page. We then posted a form to that window.

The problem is that the URL of the pop up window is defaults to about:blank when not specified. Apparently about:blank is considered insecure so when the attempt to POST the file back to the originating domain is made the SCRIPT5: Access is denied error arises.

The solution is to use a small stub type of html page to open and then perform the post. Once a file is chosen the FILE post does not see the error and the file makes it up as desired.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜