我有一个文档内容显示在MVC Web应用程序的IFrame中。内容不应该被复制和打印。我试图禁用右键使用两个函数style =“pointer-events:none;” oncontextmenu =“返回false”iframe,它工作正常。 但是在右键单击时,会显示'View Frame Source','View Source'弹出窗口。我怎样才能限制这一点。 另外,如何限制打印屏幕选项。我知道还有其他的工具可以从任何人可以捕获数据的地方找到。但客户想要限制打印屏幕选项。如何禁用在IFRAME上点击右键
<script lang=JavaScript>
function clickIE() {
if (document.all) {
return false;
}
}
function clickNS(e) {
if (document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) {
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = clickNS;`enter code here`
}
else {
document.onmouseup = clickNS;
document.oncontextmenu = clickIE;
}
document.oncontextmenu = new Function("return false")
<body oncontextmenu="return false" onkeydown="if ((arguments[0] || window.event).ctrlKey) return false" >
<div id="div1" style="background-color:Red; height:120px">
<iframe id="id1" src="" name="I1" scrolling="no" height="100%" width="100%" marginwidth ="0" marginheight="0" onload="disableContextMenu();" style="pointer-events:none;" />
</div>
请任何帮助表示赞赏.. !!
如果用户看到它,则无法阻止用户复制。我的意思是,没有。 – 2014-10-27 07:49:52
哦,但我希望有一个迂回的解决方案:-)。我们可以限制iframe内容的打印屏幕选项吗? – Lax 2014-10-27 07:51:39
我的手机上有相机。大声笑 – 2014-10-27 07:53:01