Search This Blog


Thursday, September 5, 2013

jQuery: Disabling the native right-click contextual menu of the browser

Sometime you need to disable the default right-click context menu of the browser, on your web site, here is how to do it.

By using JavaScript, you can disable the browser’s native right-click contextual menu. Doing so with jQuery is a snap. We simply cancel the contenxtmenu event.

To test the functionality on your page, copy and paste the following code into index.html blank page:

You may be wondered where is the <head> and <title> tags, they are optional in HTML5 :).