Results 1 to 7 of 7

Thread: protect an image

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146

    Question

    Hi folks,
    could one of you kind people please provide me with a script that defeats someone from right-clicking an image to save it, so that I can protect some of my hard work.
    Thanks in advance
    Merry Christmas
    GRAHAM

  2. #2
    Guest
    Code:
    <HTML>
    <BODY oncontextmenu="return false">
    <IMG SRC="img.gif">
    </BODY>
    </HTML>
    but people ca always go to view->source, see where the pic is located, and download it.


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146
    Thanks very much Dennis,
    I did have a short JavaScript written down somewhere
    (can't find it)that brought up a message box stating "sorry this image is copyright" when an image was right clicked, that replaced the 'save as' dialog box.
    Would you or anyone else be able to provide me with something similar in JS.

    cheers
    GRAHAM

  4. #4
    Guest
    sure...

    Code:
    <HTML>
    <HEAD>
    <script LANGUAGE="JavaScript1.1"> 
    <!-- 
    var ns4 = (document.layers)? true:false 
    var ie4 = (document.all)? true:false 
    
    
    function press(e) { 
        if ((ns4 && (e.which == 3 || e.which == 2)) || (ie4 && (event.button == 2 || event.button == 3))) { 
            alert ("Stop trying to steal my pictures...what's wrong with you anyway?") 
            return false 
        } 
        return true     
    }for (var i=0; i<document.images.length; i++) document.images[ i ].onmousedown=press 
    for (var i=0; i<document.links.length; i++) document.links[ i ].onmousedown=press 
    document.onmousedown=press 
    if (ns4) window.captureEvents(Event.MOUSEDOWN)
    window.onmousedown=press 
    //--> 
    </script>
    
    </head>
    <BODY oncontextmenu="return false">
    testing
    <IMG SRC="img.gif">
    </BODY>
    </HTML>

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146

    Talking

    BRILLIANT..
    Thanks alot Dennis,
    I,ll go and give that a whirl now.

    Merry Xmas and a Happy New Year to you Dennis
    and the same to all the Forum members and Admins.
    especially those of you who have helped me over the past year or so,

    GRAHAM

  6. #6
    Guest

    Lightbulb

    Will the above solution prevent someone from
    saving the whole web page as Web Page?
    If not, all immages would be saved in separate folder
    for the thief.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146
    Hi again,
    Point taken Sadovod, I suppose if someone's really determined they'll find a way no matter what. At least the visitor will be informed that the image is copyright, not that it matters to some people today, as they steal complete sites from what I've seen and heard.

    MasterGoon, if you can find such a script I would appreciate a copy of it.

    I managed to find my original script after, it's not up to par with Dennis's script, but achieves the same end

    <script language="JavaScript">
    <!--
    function click() {
    if (event.button==2) {
    alert('Copyright etc, etc')
    }
    }
    document.onmousedown=click
    // -->
    </script>

    Cheers all
    GRAHAM

Posting Permissions

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



Click Here to Expand Forum to Full Width