Disable Right Click Context-Menu On Images - Cyber Tweaks

Ads Top

Disable Right Click Context-Menu On Images



If you don't want someone copying your images easily without your permission then this is the script to prevent users from doing that. It disabled right-click Context-Menu On images so no one can use image save option to copy or save your images.

1. Disabling Right Click on all Images


With Alert Box :

<script type="text/javascript">
//<![CDATA[
    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>

Without Alert Box:

<script type='text/javascript'>
//<![CDATA[
    function nocontext(e) {
        var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName;
        if (clickedTag == "IMG") {
            
            return false;
        }
    }   
    document.oncontextmenu = nocontext;
//]]>
</script>

2.Disabling Right Click on Specific Image


Add This Code within <img> Tag

oncontextmenu='alert("Image context menu is disabled");return false;'

Example:

<img oncontextmenu='alert("Image context menu is disabled");return false;' src="http://4.bp.blogspot.com/-UzwQrb-UgQY/UJaD0AG7jMI/AAAAAAAAIak/fdcIYpOHXAA/s1600/right-click-disable-on-images.jpg" />

Right-click on images will be disabled to users, first check out your self.

1 comment:


  1. Artikel yang sangat bagus sekali
    Thanks for sharing this information


    izin share ya min^^


    Railah Kemenangan besar anda hari ini hanya di www.SonicQQ,co
    Dijamin 100% tanpa ROBOT ! PLAYER VS PLAYER ! FAIR PLAY

    Tingkat Kemenangan 99%

    Pin BB : E3D9498F


    Atau bisa langsung dicoba link di bawah ini^^

    https://bit.ly/2S5fW3A

    Kami akan melayani anda 24 jam

    ReplyDelete

Powered by Blogger.