How to ignore Control+C (copy) on web browser

若如初见. 提交于 2019-12-05 18:27:54

if your body tag adds these events

<body oncontextmenu="return noMenu();" onkeydown="return noKeys(event);">

and you then define these functions in your <head> section, you can take action when the context menu is activated (right click) or when keys are pressed on your page.

<script type="text/javascript">
function noMenu()
{
    alert("Not Allow Right Click!");
    return false;
}

function noKeys(event)
{
    if (event == null) event = window.event;
    // here you can check event.keyCode
    return false;
}
</script>
harry

Have a look at this website

But if someone wants to copy your content, they can. It will just make it harder and more time consuming to use.

And also

Regarding this Ctrl-C you could add javascript to block it, but it is useless, since the user can always disable javascript. In fact many users will find interception of right-click very annoying.

All these could have a meaning if you are building an intranet application or you can ship an integrated browser for users to view the application. With public html, I believe it isn't even worth trying. One solution would be to build your application with flash or another plug-in. This way you can encrypt everything you've sent to the client.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!