当前位置:首页 > 安卓工具助手

【技術分享】保護網站版權JS代碼 禁止 Ctrl和S 、F12控製台 、保存頁麵 、複製文字

禁止用戶複製網站的技术禁止文字內容,例如小會談/下載網站,分享复制我們可以通過下列計劃晉升複製內容的驻防制台門檻,來實現我們的网站文字白夜极光百度百科目標。

1.禁用選中和右鍵 :
<body>標簽中增補以下代碼:
oncontextmenu=return false 禁止右鍵
ondragstart=return false 禁止拖動
onselectstart =return false 禁止選中
onselect=document.selection.empty() 禁止選中
oncopy=document.selection.empty() 禁止複製
onbeforecopy=return false 禁止複製
onmouseup=document.selection.empty()
如下 :
<body leftmargin=0 topmargin=0 oncontextmenu=return false ondragstart=return false onselectstart =return false onselect=document.selection.empty() oncopy=document.selection.empty() onbeforecopy=return false onmouseup=document.selection.empty()>
2.禁止網頁另存為:在<body>後麵加入以下代碼 :
<noscript>
<iframe src="*.htm"></iframe>
</noscript>
這時在電腦端已經無法選擇複製 ,版权保存但是代码白夜极光怎么配队在移動端還可以選中複製,再增補以下css代碼用來禁止選中文字。页面
3.禁止選中文字
*{
moz-user-select: -moz-none;
-moz-user-select: none;
-o-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
user-select:none;
}
這時正常的技术禁止選擇複製都已經被禁用但是還可以用校驗器的查校驗源碼和調試工具來直接從代碼中複製內容。
4.禁用F12按鍵
//禁用F12
window.onkeydown = window.onkeyup = window.onkeypress = function(event){
// 判斷是分享复制否按下F12,F12鍵碼為123
if(event.keyCode == 123){
event.preventDefault(); // 阻止默認事件行為
window.event.returnValue = false;
}
}
5.禁用調試工具
var threshold = 160; // 打開控製台的驻防制台寬或高閾值
// 每秒檢查一次
var check = setInterval(function(){
if(window.outerWidth - window.innerWidth> threshold ||
window.outerHeight - window.innerHeight> threshold){
// 如果打開控製台  ,則刷新頁麵
window.location.reload();
}
},网站文字 1000);
6.禁用CTRL+S 保存網頁代碼
functionctrl_key(){
//禁用CTRL+S 保存網頁代碼
if(event.keyCode == 17){
window.alert("請尊重本網站版權!");
returnfalse;
}
}
1.禁用選中和右鍵:在標簽中增補以下代碼:oncontextmenu=return false    禁止右鍵ondragstart=return false    禁止拖動onselectstart =return false    禁止選中onselect=document.selection.empty()    禁止選中oncopy=document.selection.empty()    禁止複製onbeforecopy=return false    禁止複製onmouseup=document.selection.empty() 如下:2.禁止網頁另存為:在後麵加入以下代碼
:   這時在電腦端已經無法選擇複製
,版权保存但是代码白夜极光支援攻略在移動端還可以選中複製,再增補以下css代碼用來禁止選中文字。页面3.禁止選中文字*{moz-user-select: -moz-none;-moz-user-select: none;-o-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;}這時正常的技术禁止選擇複製都已經被禁用但是還可以用校驗器的查校驗源碼和調試工具來直接從代碼中複製內容。4.禁用F12按鍵//禁用F12window.onkeydown = window.onkeyup = window.onkeypress = function (event) {// 判斷是白夜极光怎么使用助战否按下F12,F12鍵碼為123if (event.keyCode == 123) {event.preventDefault(); // 阻止默認事件行為window.event.returnValue = false;}}5.禁用調試工具var threshold = 160; // 打開控製台的寬或高閾值// 每秒檢查一次var check = setInterval(function() {if (window.outerWidth - window.innerWidth > threshold ||window.outerHeight - window.innerHeight > threshold) {// 如果打開控製台
,則刷新頁麵window.location.reload();}}, 1000);6.禁用CTRL+S 保存網頁代碼function ctrl_key() {//禁用CTRL+S 保存網頁代碼if (event.keyCode == 17) {window.alert("請尊重本網站版權!");return false;}}
1.禁用選中和右鍵:在標簽中增補以下代碼:oncontextmenu=return false 禁止右鍵ondragstart=return false 禁止拖動onselectstart =return false 禁止選中onselect=document.selection.empty() 禁止選中oncopy=document.selection.empty() 禁止複製onbeforecopy=return false 禁止複製onmouseup=document.selection.empty() 如下:2.禁止網頁另存為:在後麵加入以下代碼 : 這時在電腦端已經無法選擇複製 ,白夜极光如何突破但是在移動端還可以選中複製,再增補以下css代碼用來禁止選中文字 。3.禁止選中文字*{moz-user-select: -moz-none;-moz-user-select: none;-o-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;}這時正常的選擇複製都已經被禁用但是還可以用校驗器的查校驗源碼和調試工具來直接從代碼中複製內容。4.禁用F12按鍵//禁用F12window.onkeydown = window.onkeyup = window.onkeypress = function (event) {// 判斷是否按下F12 ,F12鍵碼為123if (event.keyCode == 123) {event.preventDefault(); // 阻止默認事件行為window.event.returnValue = false;}}5.禁用調試工具var threshold = 160; // 打開控製台的寬或高閾值// 每秒檢查一次var check = setInterval(function() {if (window.outerWidth - window.innerWidth > threshold ||window.outerHeight - window.innerHeight > threshold) {// 如果打開控製台,則刷新頁麵window.location.reload();}}, 1000);6.禁用CTRL+S 保存網頁代碼function ctrl_key() {//禁用CTRL+S 保存網頁代碼if (event.keyCode == 17) {window.alert("請尊重本網站版權 !");return false;}}

放在網站底部即可

分享到: