Skip to content
Advertisement

oncontextmenu=”return false;” is not working in Opera?

In my application having the requirement for disable the right click feature.

So I used the oncontextmenu="return false;" in the body tag.

It works fine in all browsers except Opera.

How can I disable the right click in Opera. ?

I have searched a lot in Google and can’t find the solution there.Hope you people can help me for a good solution.

Advertisement

Answer

try this

document.getElementsByTagName("body")[0].oncontextmenu = function(e){ e.preventDefault();}
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement