我在jquery中有一个函数来处理iframe,但是它给出了错误:拒绝访问。 我正在使用IE 8 PFB代码:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function resizeIframe(iframe) {
iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
}
</script>
</head>
<body>
<iframe src="http://www.mysite.com" id="idIframe" onload="resizeIframe(this)" ></iframe>
</body>
</html>
我也试过调试但是我找不到确切的解决方案...... 有人有任何想法吗?
答案 0 :(得分:1)
您不能访问已加载到框架中的其他网站的DOM。
据推测,www.mysite.com
不是iframe本身出现的网站。 (请注意,mysite.com
和www.mysite.com
是不同的网站。