D
Diego Fernández Santos
Access Denied error in IE6 when try to access to a IFRAME without src
This problem only happens in IE6, in Firefox it works well. It happens
when I change the document domain and then try to access to an
existing IFRAME, without src attribute.
How can I specify the iframe content of a IFRAME without src if the
parent can not access to it?
To see the error you have to put the next document in a web server
with the domain "www.microsoft.com", you can create a new entry in the
hosts file.
<html>
<head>
<script type="text/javascript">
document.domain = "microsoft.com";
</script>
</head>
<body>
<iframe id="myFrame"></iframe>
<script type="text/javascript">
window.onload = function() {
var f = document.getElementById('myFrame');
f.contentWindow.document.body.innerHTML = "Perfect!";
}
</script>
</body>
</html>
This problem only happens in IE6, in Firefox it works well. It happens
when I change the document domain and then try to access to an
existing IFRAME, without src attribute.
How can I specify the iframe content of a IFRAME without src if the
parent can not access to it?
To see the error you have to put the next document in a web server
with the domain "www.microsoft.com", you can create a new entry in the
hosts file.
<html>
<head>
<script type="text/javascript">
document.domain = "microsoft.com";
</script>
</head>
<body>
<iframe id="myFrame"></iframe>
<script type="text/javascript">
window.onload = function() {
var f = document.getElementById('myFrame');
f.contentWindow.document.body.innerHTML = "Perfect!";
}
</script>
</body>
</html>