Disabling right clic menu

We cannot protect our pictures, but we can slow down people who want to make a copy of our pictures.

Disabling right clic options is easy : you just have to replace
body

by

body id="top" onselectstart="return false" oncontextmenu="return false" ondragstart="return false" onMouseOver="window.status=''; return true;"

in your template files !

With this simple trick, you must now use the printscreen keyboard key, ore browse the cache of your browser, to copy or find your pictures.

If possible, I would like Zenphoto developers to add this in their templates for next update !

Comments

  • acrylian Administrator, Developer

    We will not add this to official themes. No one really should. The context menu does include many more functions than downloading files. This is really an stone age old topic for 20 years that should not be discussed anymore and does not hinder anyone really much wanting to get anything.

    You don't even need to go to the cache, you can just disable JavaScript. Our old and still valid statement here:
    https://www.zenphoto.org/news/site-protection/

    And here is a 2002 article about this: https://www.sitepoint.com/dont-disable-right-click/

  • I have had a look to your links.
    I understand your point of view.

    I'm not a professional, nothing to sell, I do not want many visitors right now :
    I have managed Bing, Yahoo, Qwant and others not to rank my pages, but Google did ...

    I keep the above non javascript solution.
    You cannot disable it.
    On my 3D picture pages, Ctrl U and Ctrl I do not help - this slows down some people.

    Right click menu is only affecting my pages : people who visit my site by accident have to accept my limitations.
    Family and friends are not annoyed by them.

    I will probably remove these limitations in a year or 2, when what I want to do will be done.
    So much work to do before !

    Thank you for your comments.

  • acrylian Administrator, Developer

    I'm not a professional, nothing to sell, I do not want many visitors right now :
    I have managed Bing, Yahoo, Qwant and others not to rank my pages, but Google did ...

    Use a proper robots.txt file to exclude, they should follow that order. Also use <meta> elements to prevent indexing, we have a plugin for that. But of course if every anyone links to your site it may be added to their catalogue.

    If you really don't want to be indexed, use htaccess password protection for your site. That is the only way to really make sure this does not happen.

    I keep the above non javascript solution. You cannot disable it.

    Not true, it IS a pure JavaScript solution as you are using JavaScript inlinehandlers. You could even add all this dynamically via a plugin. Which also means it can easily be disabled by disabling JS in the browser, either by using its own settings or by using some noscript/privacy plugin.

    But I am just giving some best practices advices and you are naturally free to do what ever you like on your own site ;-)

  • ctdlg Member
    edited October 2019

    This means I have to study a bit more, because :

    • I thought the above code was pure html code as they were <body> tag parameters.
    • I thought javascript had to start with <script>, closed by </script> tag.

      I followed your advise : I only keep the disable right click function on my image.php pages (I removed code from index.php and album.php.)

    Menu is still present at bottom of each image.php page, after page header closing tag ! Right clic menu is only disabled inside the page.

    I did use htacess protection, but removed it for my family.

    I will have a look to your <meta> elements plugin.
    Zenphoto is full of possibilities.

  • acrylian Administrator, Developer
    edited October 2019

    I thought javascript had to start with , closed by tag.

    Yes, as well. <script src="some.js"></script> loads a JS file (and the preferred way) and<script>somescript</script> is an inline JS block. But what you use within e.g. onMouseOver="window.status=''; return true;" is inline JS as well. Attributes likeonMouseOver and all the other you use do nothing without JS.

Sign In or Register to comment.