Lax*_*Lax 3 html javascript model-view-controller iframe jquery
我在MVC Web应用程序中的IFrame上显示了文档内容.不得复制和打印内容.我尝试使用两个函数style ="pointer-events:none;"禁用右键单击.iframe的oncontextmenu ="return false",工作正常.但是在右键单击时,会弹出"View Frame Source","View Source".我怎么能限制这个.另外,如何限制打印屏幕选项.我知道还有其他任何人可以捕获数据的工具.但客户想要限制打印屏幕选项.
<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")
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)
请任何帮助赞赏.. !!
要禁用右键单击菜单,您可以使用以下代码段:
document.oncontextmenu = function() {
return false;
};
Run Code Online (Sandbox Code Playgroud)
我制作了一个显示效果的JSFiddle.