以下 iframe 旨在适应其内容。它适用于 Firefox,但不适用于 Chrome。
<iframe src="Splash.html" seamless=true width=99% height=100% scrolling=no name="Content" id="Content" onload="this.height = this.contentWindow.document.body.scrollHeight + 10;">
</iframe>
当页面在 Chrome 中加载时,我收到以下错误:
Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match. Index.html:35
Uncaught TypeError: Cannot read property 'body' of undefined
当我专门使用 onload 事件时,为什么它会认为 iframe 未定义?我对网页设计比较陌生;如果问题很明显,请原谅我。