Header Ads

  • Breaking News

    Disable Copy and Paste for greater website security.


    Have you ever worked really hard on graphics for your site only to find later that someone has stolen them as their own. You can help encrypt and protect your site with the following HTML codes. No right click block is 100% effective, but they will help against novices.

    Below is a little trick that will stop your visitors from copying and pasting your webpage information.
    Use this below so when someone right clicks to save an image off your page, a message will come up letting people know that your information is copyrighted.

    Here is a handy little script which will not only protect your images from right clicking, but your whole page. Remember this only stops some visitors from viewing your source. There are ways around it and if someone really wants to view your source they may find a way. There is another trick below to protect your source code, so keep reading.

    <script type="text/javascript">
    //<![CDATA[
    /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Disable context menu on images by Micronet(mix--er.blogspot.com)
    Version 1.0  
    You are free to copy and share this code but please do not remove this credit notice.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
        function nocontext(e) {
            var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName;
            if (clickedTag == "IMG") {
                alert(alertMsg);
                return false;
            }
        }
        var alertMsg = "Image context menu is disabled";
        document.oncontextmenu = nocontext;
    //]]>
    </script>
     

    The script will disable the context menu and replace it with alert box.


    • You can replace the message with whatever you like in line 15, or
    • If you prefer not to show the alert box, just delete or comment out code line 11 and 15. To comment out a line of Javascript, place two slashes "//" in front of the line, like this:

    //var alertMsg = "Image context menu is disabled";

    Disable Copy and Paste - alternative.

    Just before ]]></skin> tag add next code:
     .post {-webkit-user-select: none; -khtml-user-select: none; -moz-user-select: -moz-none; -ms-user-select: none; user-select: none;}



    No comments

    Post Top Ad

    Post Bottom Ad