访问在执行jquery时被拒绝

时间:2013-05-16 10:22:02

标签: jquery html

我在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>

我也试过调试但是我找不到确切的解决方案...... 有人有任何想法吗?

1 个答案:

答案 0 :(得分:1)

您不能访问已加载到框架中的其他网站的DOM。

据推测,www.mysite.com不是iframe本身出现的网站。 (请注意,mysite.comwww.mysite.com是不同的网站。