www.webdeveloper.com
Results 1 to 8 of 8

Thread: Stop copy on Right Click

  1. #1
    Join Date
    Jun 2005
    Posts
    1

    Stop copy on Right Click

    Can anyone tell me why this doesn't work when I right click on an Image using Mozilla Firefox? Any corrections would be welcome.

    <script LANGUAGE="JavaScript1.1">
    <!-- Begin
    function right (e) {
    var msg = "© Sorry, this image cannot be copied.";
    if (navigator.appName == 'Netscape' && e.which == 3) {
    alert(msg); // Delete this line to disable but not alert user
    return false;
    }
    else
    if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
    alert(msg); // Delete this line to disable but not alert user
    return false;
    }
    else
    if (navigator.appName == 'Mozilla Firefox' && event.button==2) {
    alert(msg);
    return false
    }
    return true;
    }
    document.onmousedown = right;
    // End -->
    </script>

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Quote Originally Posted by chevin
    Can anyone tell me why this doesn't work when I right click on an Image using Mozilla Firefox? Any corrections would be welcome.
    Because it can't work on FF or any browser other than MSIE. And quite often it doesn't work in MSIE. The internet was designed to spread information and resources, not to keep them safe. If you don't want everybody and his dog to have a copy of your images then you have no business putting them on the internet.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,972
    You would do well to read this article about hiding content.
    Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
    (2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.

  4. #4
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    It doesn't work because ALL browsers copy the image to your visitor's computer BEFORE they display the page so they already have a copy before the page appears.
    Stephen

  5. #5
    for images, use 1x1 divs styled to the right colors. That way no one will want to copy it directly
    - God

  6. #6
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Quote Originally Posted by IncaWarrior
    for images, use 1x1 divs styled to the right colors. That way no one will want to copy it directly
    All images are copied to their computer before the page is displayed. No matter what you do with images on a web page the person viewing the page already has a copy of all of the images on their own computer.

    THERE IS NO WAY TO PROTECT IMAGES THAT ARE LOADED TO THE WEB

    The only way of applying any sort of protection AT ALL is to embed a watermark into the image itself.
    Stephen

  7. #7
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Quote Originally Posted by IncaWarrior
    for images, use 1x1 divs styled to the right colors. That way no one will want to copy it directly
    Ever heard of a "screen shot"?
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  8. #8
    Join Date
    Apr 2004
    Location
    Warning: main(location.php): failed open stream
    Posts
    1,119
    try using a pdf instead of the internet to protect files. maybe flash... but all these can be reversed the same way they can be created
    fabioDRN.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles