Icon Header

Tuesday, August 18, 2009

Simple Method to disable right-click Menus from you website

A simple method to deter users from stealing images from your web-pages is the use of the Javascript onContextMenu event. This event is fired when the user right-clicks on an item on a webpage. Returning false from the event handler function will disable the display of the Content Menu that pops up on a right-click. Of course, this is not a fool-proof way of guarding your content and a determined user can bypass this mechanism.

A much simpler implementation of disabling right-clicks:

Add the 'onContextMenu' event handler attribute in the <body> tag and hard-code the return value to 'false':

<body onContextMenu="javascript: return false;">

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home