Snippet O’ the Week: Disable Right-Click Completely with jQuery

This is a snippet I’ve been looking for for a very long time now but have never found a legit solution. Some script functions do a warning pop up or only partially disable right-click, but this little snippet completely disables it. To disable right-click is really great if you are trying to protect photos from getting stolen or things like that and I know a lot of designers and developers hate when a web site takes control over basic browser functions. But privacy is becoming a huge deal on the internet and in some case its important to protect yourself, your images and your designs from being blatantly stolen right off your digital property.

Here’s the snippet, sweet and simple – oh, don’t forget to include jQuery: (big thanks to Codrops.com for this fantastic snippet)

<script type="text/javascript">// <![CDATA[
return false;
// ]]></script>

About the author

Patrick Cox wrote 99 articles on this blog.

Patrick is a UX Designer and the co-creator of Payba.cc and Aplethora (a two man interwebs design firm). He also enjoys family, snowboarding, sports and sugar free water mix ins and.... this is his blog.


  1. Sarah

    Thanks for the snippet. I seldom run scripts that prevent browser behavior but I did have a client ask for this in the past and I was never able to pull it off. But this works great.

  2. BB

    Very nice! I adapted it to disable right-click on images only (so visitors can still open links in new tabs and copy text):

    return false;

    Thanks for the code!

  3. Mat

    All The user has to do is to turn off js.
    So… It protects nothing and bothers everyone.
    Nice job !

    Btw, The web is OPEN, it is a place to SHARE. If you Wang to enforce your copyright on pictures, there are plenty solutions like watermarking or going full-flash.