Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    5
    Thanked 0 Times in 0 Posts

    To disable right click or not?

    Hello, Thanks for reading.

    This is my first post, I hope it's not too stupid.

    Should I disable the right click option or not?

    I have a gallery site, I don't want people to be able to copy the images with the default right click over an image. From a professional looking site point of view I suppose I would be messing with the functionality a bit too much, OR is it OK in this instance to disable the click. I know how to write the code to disable the click, but what I was thinking was maybe it would be better to leave the right click but change the menu options? I'm not sure how to change the menu options, any suggestions would be appreciated

    Here is a link to the site.

    http://www.thephotographbox.com/?ID=3

    (It's still in the early stages on development)

    Thanks for any advice.

    Derek.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,171
    Thanks
    75
    Thanked 4,339 Times in 4,305 Posts
    Ummm...and why do you think that disabling right click will help???

    There are at least three simple ways I can go grab all the content I want to off of your site without using right click. And I'm sure there are more. I just thought of those three as I started typing this.

    I mean, yeah, it might stop the total internet novice, but anybody who has half a brain and has a few hours of playing around will know how to bypass right click.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,171
    Thanks
    75
    Thanked 4,339 Times in 4,305 Posts
    A better answer is to digitially watermark your photos. Even that's not going to stop the determined hacker, but at least they will have to work at it for more then 15 seconds.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    5
    Thanked 0 Times in 0 Posts
    thanks for the reply,

    Yes, you are right, this is only to stop the complete novice, the files have been save at a low res format with a basic watermark across the image, I suppose it's the same in any thing you do, if some one is determined then they will break,hack,steal your stuff, I'm just trying to stop the simple methods that are easy to stop.

    As for site functionality, is it ok to disable the right click or how to do alter the menu optoins
    Last edited by DerekPK; 12-17-2011 at 11:55 AM.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,171
    Thanks
    75
    Thanked 4,339 Times in 4,305 Posts
    Altering the menu options really means you must create a new menu yourself. Since most of the right click options perform actions that JavaScript is incapable of, it doesn't seem worth the trouble. Just disable right click and be happy.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    DerekPK (12-16-2011)

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    This is one of the FAQs.

    Q. How can I use Javascript to protect my web pages?

    A. Short answer, you can't.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #7
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thanks, you are showing your mastery of the art of programming:-) Just the answer I needed.

  • #8
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,619
    Thanks
    0
    Thanked 645 Times in 635 Posts
    One thing to remember is that there are lots of options in that menu apart from the one that could be (but rarely is) used to steal images. If you do disable the right click and your visitors are novices who don't know any of the other ways to access that menu or how to disable your request to disable it then you are blocking them from all those other options.

    Anyone serious about stealing your images would know a dozen other easier ways to do it and wouldn't know that you had even tried to disable that menu.

    Basically there is nothing you can do to prevent someone taking your HTML and CSS at all, images can be protected by watermarking (either digital or visible or both) and JavaScript can be partly protected by rewriting the code in a way that makes it hard to read. Of course the only people who even attempt to apply any protection to those have nothing worth stealing in the first place - you will notice that no established web site uses anything other than watermarking to protect images and nothing to protect the rest of their web page apart from copyright notices as anything yu do makes the experience worse for the 99.9999% of legitimate visitors and taking action afterwards with DMCAs or legal action is the only way that actually works.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    DerekPK (12-17-2011)

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,171
    Thanks
    75
    Thanked 4,339 Times in 4,305 Posts
    What felgall said. In spades. <grin/>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #10
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,296
    Thanks
    10
    Thanked 583 Times in 564 Posts
    right-click is expected, any site on which it doesn't work is functionally broken.
    use background-image instead of <img>: it doesn't offer any save options upon right-click, so you can keep the expected clickability without making it too easy to steal the images.

    a clear <input> in front of the image will also intercept the right click, offering options like paste and copy instead of save image as...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • Users who have thanked rnd me for this post:

    DerekPK (12-17-2011)

  • #11
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,619
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Quote Originally Posted by rnd me View Post
    use background-image instead of <img>
    if you do that as the background behind a transparent gif file then they still get the opportunity download an image - of course the image they would be downloading is the transparent gif rather than the one they were trying to steal and by the time they realise it would probably be more effort than they are prepared to put in to go back to your site to steal the right image.

    Any image you use with your site can be stolen by someone who knows how - assuming the image is worth stealing which 99% are not. Lowering the resolution of the image may make it less likely to be stolen as will placing a visible watermark across the image.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    DerekPK (12-17-2011)

  • #12
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,171
    Thanks
    75
    Thanked 4,339 Times in 4,305 Posts
    Okay, that gives me an idea!

    Instead of putting a transparent image on top of the real one, put a copy of the real image there...but with opacity set so that it is a near transparent as possible.

    Except on that copy have a great big "STOLEN FROM ZZZZ" plastered across it!

    So... The person downloads the image, gets the "STOLEN FROM ..." one, looks at it, and thinks you've done something magic. Granted, it's no more hack-proof than any of the other answers, but I'd bet it would confuse more people than the other ones!
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    DerekPK (12-17-2011)

  • #13
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Yes, that's all great advice, having looked around at some professional photo agencies galleries they all seem to use the methods that you guys have outlined, the blank image seems to be the most popular, I agree that tempering with the right click is not the correct way as some of you have pointed out that this would brake standard functionality.

    Thanks to all for taking the time to respond to my question.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •