.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Disable Right Click on the Page

Posted By:abhays       Posted Date: March 31, 2014    Points: 40    Category: Javascript    URL: http://www.dotnetspark.com  

Disable Right Click on the Page using Javascript

We can disable right click on any page by below ways:-

1.    In this method we add a javascript method, in this we check the mouse click, if click is right click then a message is displayed like "Right click on the page disabled"is right click then a message is displayed like "Right click disabled"

<script language="javascript">
status="Right Click on the page Disabled";
Function disableclick(e)
     return false;	


2.In this method, set the oncontextmenu="return false" in the body part

   <tr oncontextmenu="return false">


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend