Javascript 如何检测iframe内的页面高度?
我在一页中有一个iframeJavascript 如何检测iframe内的页面高度?,javascript,html,Javascript,Html,我在一页中有一个iframe <iframe src="page.aspx" > 您喜欢您的代码,但需要对其进行一些增强以避免错误 if (window.innerWidth) { //if innerWidth is defined // the standard w = fr.width, h = fr.height } else if (typeof document.documentElement != 'undefined'
<iframe src="page.aspx" >
您喜欢您的代码,但需要对其进行一些增强以避免错误
if (window.innerWidth) { //if innerWidth is defined
// the standard
w = fr.width,
h = fr.height
}
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0) {
// IE6
w = fr.document.documentElement.clientWidth,
h = fr.document.documentElement.clientHeight
}
if (window.innerWidth) { //if innerWidth is defined
// the standard
w = fr.width,
h = fr.height
}
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0) {
// IE6
w = fr.document.documentElement.clientWidth,
h = fr.document.documentElement.clientHeight
}