笔记

前端防复制 - JavaScript

<!--屏蔽鼠标右键-->

<script language="Javascript">
document.oncontextmenu=new Function("event.returnValue=false");
document.onselectstart=new Function("event.returnValue=false");
</script>

<script type="text/javascript">
document.oncontextmenu=function(e){return false;}
</script>

<!--屏蔽F12-->

<script type="text/javascript">
        document.onkeydown = function () {
            if (window.event && window.event.keyCode == 123) {
                event.keyCode = 0;
                event.returnValue = false;
                return false;
            }
        };
</script>

<!--屏蔽鼠标右键/Ctrl+C/F12-->

<script type="text/javascript">
    document.oncontextmenu = new Function("return false");
    document.oncontextmenu = function () { return false; };
    document.onkeydown = function () {
        if ((window.event && window.event.keyCode == 123) || ((event.ctrlKey) || (window.event.keycode == 67))) {
            event.keyCode = 0;
            event.returnValue = false;
            return false;
        }
    };
</script>

回复

This is just a placeholder img.