Disable the right click on a web page

Some website has right-click disabled so that user cant copy paste using mouse, or cant save images contained into webpage.

Copy paste this code

<body oncontextmenu=”return false;”>
Html page content here

**End of article**

For more articles updates and sourcecodes please visit dotnetcoderoom


About dotnetcoderoom

Working as an Onsite coordinator in USA. Handling UAT, CR (Change Requests), Product Support/Development, Build Management. Supervise and assist in live product implementation (at client side) and training. Providing technical direction for the development, design, and system integration. Closely monitoring and working with offshore team for Enhancements, Bug Fixing, Enforce coding standards, perform code reviews and mentors junior developers. Proven track of timely delivery of enterprise level web based applications. Skilled in a variety of software languages, tools, and methodologies, with a special expertise in Microsoft .NET technologies. MCTS .Net 4.0 Web applications MCTS .Net 2.0 Web applications GNIIT, MCA, B.Com Specialties 8+ Years of experience in .NET Technologies. Expertise in .NET, ASP.NET, MVC, C#, VB.NET, WCF, Web Services, MS SQL, JQuery. Excellent R&D and troubleshooting skills. Extensive knowledge in E-Commerce and Healthcare domain. View all posts by dotnetcoderoom

2 responses to “Disable the right click on a web page

  • tesi

    if I use oncontextmenu=”return false” I get an error, such as ‘oncontextmenu doesn’t exist and the rightclick stil works 😦 (browser FF, Opera)

  • dotnetcoderoom

    Hey tesi,
    thanks for your comment. Try the code below

    <body oncontextmenu="return false">
    This code works in IE (6,7), and FF (2.0,3.0).
    I tested this in morning and it works fine.
    Please try to copy paste this code and create a html file, if it still desn’t works than leave a comment.


    Ajay Sharma (Blog Author)
    MCP (.NET)
    EE – Guru

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: