Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: How do I disable right click and print screen in my website

  1. #1
    Join Date
    Sep 2005
    Location
    Chennai,India
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question How do I disable right click and print screen in my website

    Hi,
    This is my first post. I need help in disabling right click and print screen in my website. Is there any scripts for this or how can I control it.

    Venu.
    My Website

  2. #2
    Join Date
    Aug 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Put this code into a javascript in your heading

    <!--

    //Disable right click script III- By Renigade (renigade@mediaone.net)
    //For full source code, visit http://www.dynamicdrive.com

    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers)
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

    document.oncontextmenu=new Function("return false")
    -->

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Dance10Looks10
    Put [a right-click blocker] into a javascript in your heading
    And expect it to do what, exactly? Protect content? Not a chance.

    To the OP: read around. Content cannot be protected on the Web. People that might take it for redistribution (rather than personal use, which shouldn't be an issue) know how to get around any trick you try to use. The end result is stolen content, but legitimate users that can no longer use their browser properly.

    Watermark content, or reduce its quality. Make sure that there's no point in redistribution.

    Mike

  4. #4
    Join Date
    Aug 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The question was how to disable the right mouse button and not prevent hijacking of code.

    The code I put in does indeed disable the right mouse click. After that, this User is on their own in terms of theft prevention which wasn't mentioned in the original question of "How can I disable the the right mouse?"

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Dance10Looks10
    The question was how to disable the right mouse button and not prevent hijacking of code.
    Where did I mention anything about code?

    The OP has a gallery, and the Print Screen key was explicitly mentioned. It doesn't require a great leap in reasoning to anticipate that the OP is trying to protect either those photographs, or other content elsewhere within the site. Suggesting what you did will give the illusion (and it is just an illusion) that such efforts actually achieve something worthwhile. They do not.

    The code I put in does indeed disable the right mouse click.
    No. In some instances it may disable the context menu, but it is far from guaranteed. Even then, it is trivial to disable the script itself. Now read the second paragraph in my previous post, with emphasis on the enclosed phrase.

    After that, this User is on their own in terms of theft prevention [...]
    I prefer not to intentionally mislead those that ask for help.

    Mike

  6. #6
    Join Date
    Mar 2005
    Location
    The Netherlands
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    you can always when thy right click. give them a note witch says contact webmaster or artist.etc..

    <SCRIPT TYPE="text/javascript">
    var message="Please email the Artist for your interest .";
    function click(e) {
    if (document.all) {
    if (event.button == 2) {
    alert(message);
    return false;
    }
    }
    if (document.layers) {
    if (e.which == 3) {
    alert(message);
    return false;
    }
    }
    }
    if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    }
    document.onmousedown=click;
    </SCRIPT>

  7. #7
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by webtech
    you can always when thy right click. give them a note witch says contact webmaster or artist.etc..
    If you want to provide arrangements for users to legally obtain copies of artwork or other media, then that should be displayed as text on the page. Stop trying to interfere with the user!

    Your code doesn't work in Gecko-based browsers (and others), by the way.

    Mike

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    javascript:html="";e=document.images;for(j=0;j<e.length;j++) html+="<img src=\""+e[j].src+"\"/> &nbsp; </img>";void(document.body.innerHTML=html);void(document.getElementsByTagName("script")[0].innerHTML = "");
    Put that in the address bar of your favourite Javascript-enabled browser, then press enter. Ta-da, instant unprotected images. The above will disable all scripts and HTML, except the images. The moral of this story, folks, is that you can't use client-side scripting to disable anything. Client-side scripts are on the user's computer. What the user holds, the user controls. For that matter, the images have already been downloaded onto the user's computer and can be accessed from the browser's cache directory.
    Last edited by Twey; 10-04-2005 at 04:34 PM. Reason: Whoops, the forum doesn't like e[i].
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Oct 2005
    Location
    england
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    if you website is made of tables change the img src="asdjgnbajdrbg" to background="dsbfiadbgviabg" and peeps can't copy

  10. #10
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Hybrid
    if you website is made of tables
    One should consider getting with the times.

    change the img src="asdjgnbajdrbg" to background="dsbfiadbgviabg" and peeps can't copy
    Rubbish.

    Mike

Bookmarks

Posting Permissions

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