div overlay用于阻止可点击的事件iframe在IE中不起作用

Pra*_*h R 4 html css iframe internet-explorer

我有一个iframe显示网页,我需要阻止该页面的所有点击事件.我使用了以下代码

 <div id="IframeWrapper" style="position: relative;">
    <div id="iframeBlocker" style="position: absolute; top: 0; left: 0; width:95%; height:95%;z-index:2"></div>
     <iframe  id="iframewebpage" style="z-index:1"  runat="server"></iframe>
    </div>
Run Code Online (Sandbox Code Playgroud)

这适用于除IE之外的所有浏览器(8和9).任何变通方法?

tal*_*gna 5

不知道为什么以上不起作用,理论对我来说都是正确的,但在设置背景时,它似乎成功渲染div.虽然下面的代码不允许你在iframe上使用滚动条,但它应该是一个好的起点.我删除了z-index,因为在iframe之后渲染阻塞程序意味着它将呈现在它的"顶部".

<div id="IframeWrapper" style="position: relative;">
    <iframe  id="iframewebpage" style="z-index:1"  runat="server" src="http://www.w3schools.com" ></iframe>
    <div id="iframeBlocker" style="position:absolute; top: 0; left: 0; width:95%; height:95%;background-color:aliceblue;opacity:0.1;"></div>
</div>
Run Code Online (Sandbox Code Playgroud)