Skip to content Skip to sidebar Skip to footer

Internet Explorer: Can't Access IFrame Contents Unless Status Code Is 200

Because IE doesn't support Asynchronous file uploads, I'm using a work-around that involves posting a form to an iframe. I bind the the onLoad event of the iframe and read its cont

Solution 1:

I think I've worked this one out while trying to reproduce the problem on fiddler. Turning off the "Show Friendly HTTP error messages" in IE seems to fix it. The reason I couldn't reproduce it on fiddler is that their 404 pages are over 512 bytes, hence it would show the nginx error regardless.

Basically, the whole issue is that when a page is less than 512 bytes (or 256 in some cases), IE seems to substitute the whole page which has the consequence of blocking access to that page programmatically. Obviously an oversight by Microsoft which still seems to be present in IE10.

It's easy to reproduce. Just place the following in a file (e.g. test.html) under a server than returns a 404 response code under 512 bytes, and ensure your IE is set to show friendly error messages (also make sure "test1.file" doesn't actually exist). Hit the page with IE with the developer console open, and you should see a "access denied" error. How you refresh the page alters the outcome. A CTRL+F5 doesn't seem to exhibit the problem, but a CTRL+R or F5 does.

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script type="text/javascript">
iframe = document.createElement('iframe')
iframe.src = '/test1.file'
document.body.appendChild(iframe )
iframe.contentDocument
</script>
</body>
</html>

Now, if only I could find where I can submit bug reports for IE10 so we can make our life dealing with this horrific browser just a little better.


Post a Comment for "Internet Explorer: Can't Access IFrame Contents Unless Status Code Is 200"