1
現在,我使用此代碼禁用右鍵點擊:如何禁用某些HTML頁面上點擊右鍵有一些例外
$("body")
.attr('ondragstart', 'return false')
.attr('onselectstart', 'return false');
var message='Right click is disabled on this page!';
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');
我自己的現在,我已經實現了上下文菜單,我顯示它當點擊某個a
元素與類.context
。
我使用http://medialize.github.io/jQuery-contextMenu/demo.html
所以我想禁用除一個與.context
類的所有右鍵單擊上下文菜單
您必須從某處已經沒有東西像10多年來一直更新 – erikkallen
實在是禁用右鍵點擊任何萬無一失的方法複製粘貼此。任何人都可以查看您的來源並隨心所欲。甚至在Firebug或其他程序中打開它並實時禁用腳本。除了激怒用戶之外,它不會取得多大成就。 –
我同意,從可用性的角度來看,這是一個非常糟糕的做法。除了可能是惱人的用戶之外,你絕對沒有什麼收穫。 – luk2302