中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

如何在自己網(wǎng)站設(shè)置屏蔽右鍵防復(fù)制

2018-11-01    來源:學(xué)做網(wǎng)站論壇

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用

很多網(wǎng)站原創(chuàng)的內(nèi)容會被惡意復(fù)制,或者自己有版權(quán)的東西不希望被別人轉(zhuǎn)載,可以在自己做網(wǎng)站時可以增加防復(fù)制,禁止右鍵的功能,也可以達(dá)到網(wǎng)站文章復(fù)制自動加版權(quán)信息的功能。

如何在自己網(wǎng)站設(shè)置屏蔽右鍵防復(fù)制

方法/步驟

在網(wǎng)站的<head>標(biāo)簽里加上一段JS代碼,這樣當(dāng)別人在我們做網(wǎng)站上使用右鍵時,就會提示“不能復(fù)制”。

<SCRIPT language=JavaScript> function click() { alert('謝絕復(fù)制!')} function clickl(){ if (event.button==2){alert('請諒解!')}} function ctrlkeydown(){ if (event.ctrlkey) {alert('本網(wǎng)站禁止復(fù)制!')}} document.onkeydown=ctrlkeydown; document.onselectstart=click; document.onmousedown=clickl; </script>

上面的代碼就可以防止別人在我們的網(wǎng)站上使用右鍵復(fù)制了。

如果你想禁止左鍵選擇同時防右鍵復(fù)制,可以使用下面的代碼:

<!--

//屏蔽左鍵文本選擇
document.onmousedown = function() {
return false;
};

document.onselectstart = function() {
return false;
};

//屏蔽右鍵
if (window.Event)
document.captureEvents(Event.MOUSEUP);

function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;

return false;
}

function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}

}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->

以上是PHP網(wǎng)站防復(fù)制的方法,如果是ASP網(wǎng)站,可使用這個方法:網(wǎng)站如何防復(fù)制,防采集。

標(biāo)簽: 代碼

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:如何制作網(wǎng)站面包屑導(dǎo)航

下一篇:如何去除課程中優(yōu)酷廣告 及 觀看 高清視頻課程 方法