Daily Tip: How to Disable Right-Clicking on Your WordPress Blog

April 17, 2010  | 
15 Comments

If you have a lot of copyrighted images or you don’t want people stealing parts of your design, here’s a quick way to disable right-clicking within WordPress. There are plugins that will do this for you, but I think this is easier than installing a plugin. Open your header.php file and add this jQuery snippet right before the closing < /head> tag:

<script type="text/javascript">
$(document).ready(function(){
    $(document).bind("contextmenu",function(e){
        return false;
    });
});
</script>

Save the changes. Now test right-clicking on your images. Nothing happens. That’s how you can tell it’s working. :)

Featured Plugin - Open an Online Store with MarketPress

Out of all the WordPress ecommerce plugins available, this has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - Start Your Own Powerful Membership Site

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - Turn any WordPress page into a fully featured wiki!

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - Host sites, get paid, just like WordPress.com

If you've ever wondered how you could offer a paid site management and hosting service, then this is the plugin for you. Offer a freemium or paid service, for any niche you like, it's powered Edublogs.org to success already!
Find out more

Featured Plugin - Send beautiful html email newsletters, from WordPress!

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Featured Plugin - Start your own Quora / StackOverflow / Yahoo Q&A site

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - Add bottom corner (or anywhere else) chat to your site

No javascript required, no third part chat engine, just fully featured chat right in your own database on your own WP sites - couldn't be easier.
Find out more

Featured Plugin - Every great SEO tweak you need, in one snazzy bundle

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Featured Plugin - WordPress + Google Maps = Perfect

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

15 Responses to Daily Tip: How to Disable Right-Clicking on Your WordPress Blog

  1. Unfortunately this is incredibly easy to circumvent, just disable Javascript in your browser. I’d recommend watermarking your images if you don’t want them used elsewhere. Also, make sure you have an appropriate copyright declaration on your site informing visitors how they may use your content.

    Disabling the context menu is just likely to irritate your repeat visitors. If someone really wants an image from your site, they’ll find a way to do it.

  2. Certainly it’s not a cure-all. It’s just a road block that makes it a little more difficult for the average internet user.

  3. Yes, this might stop somebody using your pictures in their projects illegaly.

    Though, most of them will anyway copy that image from google image search.

    And it’s not any big and scary bunch of people, who could harm you in a bad way. Yes, some teenager might use your images in their blog – big thing? Put your name to the corner of your images and just relax. :-)

    What about those who want to right-click links to open them to tabs? Or copy text? Or paste text to inputs? Or use images as a background of their desktops?

    I think you should also point out negative sides of this JS-trick.

  4. I don’t think this is a cure at all. It does very little to prevent images from being copied (taking a screenshot or disabling JS is very easy). But more importantly it prevents users from accessing features of their browser. In Firefox it gives me the options to Bookmark or email the URL, which I am sure most site owners would appreciate.

    Right click menus are commonly used in the operating system, so by disabling it you may be frustrating your users.

    Please don’t use this technique. If users really want to steal your photos there is nothing you can do to prevent it.

  5. Certainly it’s not for every site and yes, there are numerous ways to get to images. However, I’ve had a good number of clients who have required this for their visual media oriented sites because it helps to cut down on casual swiping. You might be surprised how many people don’t know how to disable javascript in their browser or even how to take a screenshot. This isn’t something I’d recommend for everyone, but I have often been asked how to do it.

  6. I have to strongly disagree with this as a UI decision. I use right click regularly to open links in new tabs, print screens, search text,and more. IMO, this is right up there with disabling the back button. Websites in general are not consistent with when they open new windows, so it’s up to me to open a new tab when I want to with right click.

    There’s also other ways to get the images besides disabling JS. Firebug will give you the images links, and you can always just view the source (which can still be done without right-clicking).

    Please, convince your clients to use watermarks. Don’t do this.

  7. Interesting debate this has caused. :) I think it’s cute how you think it’s so obvious that people can grab the images using Firebug or by viewing the source. Believe it or not, most internet users don’t know the difference between a browser and a search engine. If someone wants to sacrifice right-clicking for printing and opening new windows on their site in order to block what is more than likely 90% of those who are attempting to grab a copyrighted image, then I think it’s fine. I can see the value of this for a portfolio site that is almost 100% images, especially if that is this person’s livelihood. If the artist believes that watermarking the image interferes with properly showcasing their work and would rather disable right-clicking, I don’t see how that is a big deal. The visitor is there to see the images, not to print text or click through to other sites linked within text. This is the kind of site I’m referring to, not a content heavy blog with a few images splashed about. However, I understand that strong reaction against disabling right-clicking. I’m a big right-clicker myself. :)

  8. Thanks, neat little trick, but i agree, i guess people will simply get from google image search?

  9. Sarah: instead of this nasty JS-trick, you should use this to prevent casual copy-cats copying your images (prevents right-click-save-as):

  10. Thanks Michael, I like that solution :)

  11. BTW, what is that syntax highlighter you are using here? :-) It’s nice.

  12. Believe it or not, most internet users don’t know the difference between a browser and a search engine…

    Funny to see how big is (still) the gap between developers and end-users. This has been the main problem for the last 20 years…When will the “Make it simple” understood by the majority?
    I totally agree with you Sarah, “standard” users don’t know Firebug or whatsoever because they use their computers like we drive a car, just going from A to B. Who can blame them in a way?
    But developers still consider drivers can easily change a clutch or fine tune the injection :-)

    I do protect my images by watermark of course but won’t get fever if a guy has the right click disabled. It’s his choice and if one really need an element he can still view the source, that’s it. :-)

    Anyway keep up the good work!
    Roger

  13. Truly Amazing Your Disable Code.It Simply Get Worked Within A MiNUTES

Click on a tab to select how you'd like to leave your comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting