0
我的網頁防護JS文件看起來像jQuery函數不能正常工作
(function($){
$.fn.disableSelection = function() {
return this.each(function() {
$(this).attr('unselectable', 'on')
.css({
'-moz-user-select':'none',
'-webkit-user-select':'none',
'user-select':'none',
'-ms-user-select':'none'
})
.each(function() {
this.onselectstart = function() { return false; };
});
});
};
})(jQuery);
var message="Bu səhifədən material kopyalamaq qadağandır!";
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
} else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
除了$ .fn.disableSelection所有功能很好地工作。它必須禁用選擇。但我可以選擇任何一段文字。我錯過了什麼?
請發表您的HTML代碼 – Nirmal 2012-07-17 12:42:18
自從Netscape Navigator 6發佈以來,函數'document.layers'已被棄用。這個瀏覽器在新世紀的頭幾年中死亡。所以你可以從你的代碼中刪除它。 – reporter 2012-07-17 12:44:45
爲什麼要使用這種反用戶技術?如果你通過HTTP提供服務,那麼複製就會很微不足道,並且傾向於在最低限度的能力上激怒他們。 – 2012-07-17 12:59:41