企業網站如何添加防右鍵復制功能?
作者:北京做網站公司 更新時間:2022-02-08
在我們瀏覽同行網站的時候,有時候覺的這篇文章寫的比較不錯,就想把這篇文章保存下來或者加到自己的網站上,但是當你點擊鼠標右鍵的時候卻沒有反應。
說明這個網站添加了防右鍵復制的功能,沒有辦法右鍵復制他的網站內容,下面北京網站建設介紹一種防右鍵復制的代碼:
function stop(){
return false;
}
document.oncontextmenu=stop;
if(document.all){ document.onselectstart= function(){return false;};
}else{ document.onmousedown= function(){return false;}; document.onmouseup= function(){return true;};}document.onselectstart = new Function('event.returnValue=false;');