Hi I'm keeping up a site for a friend and right-clicking is disabled and I want it enabled and I don't use JavaScript yet(learning), but from what I've researched disabling right clicking is done using

oncontextmenu="return false;". 

But I've searched through the js documents and don't find that but I do find this bit and think it may be relevant

("contextmenu mousedown",function(){return false})}return false})};. 

Any ideas?

有帮助吗?

解决方案

If you remove "return false" from that line it will bring back the right click menu.

You could possibly remove more but I'd need to see more of your code - but removing the "return false" part will definitely fix it.

Edit:

("contextmenu mousedown",function(){return false})}return false})};

Looks like a section of jQuery code to handle events. This part:

function(){return false}

Is run whenever the contextmenu or mousedown event fires. So if you remove the "return false" part of that, nothing will happen and the event will be handled normally by the browser.

I'm not sure why my answer was downvoted, given that its correct.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top