devxlogo

Stop Users from Right-Clicking on Your Web Site

Stop Users from Right-Clicking on Your Web Site

To prevent your users from performing any of the other commands available by right-clicking on a web page in Internet Explorer, simply modify the opening &ltbody&gt tag of your HTML:

 

When the menu is requested, the oncontextmenu event runs. This cancels it instantly using JavaScript. The script isn’t foolproof, but it should prevent a majority of the visitors from your site from accessing the “right-click” context menu.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist