我在我的页面上设置了一个iframe,并使用以下脚本来删除双重导航栏。它在任何浏览器上都很好用,但在Chrome上不起作用,它会显示双重垂直导航栏!
function calcHeight() {
//find the height of the internal page
var the_height = document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById('the_iframe').height = (the_height + 30) +"px";
}
我在Chrome中收到2个错误信息:
First error message:
Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
and it points out the error at:
var the_height = document.getElementById('the_iframe').contentWindow. document.body.scrollHeight;
Second error message, it is located in jquery-1.10.2.js:
Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
It points out the error message at:
elem.contentDocument || elem.contentWindow.document :