父级页面监听iframe点击事件

通过contentDocument属性
定义和用法:
contentDocument 属性以 HTML 对象返回框架容纳的文档。
语法:frameObject.contentDocument

html:
<iframe id="iframe"  frameborder=0 scrolling="no"></iframe>

父级页面js:
document.getElementById('#iframe').contentDocument.on('click', () => {
	...
})

猜你喜欢

转载自blog.csdn.net/PGD_607/article/details/103459952