Proxy > Gmail Facebook Yahoo!

Javascript : Disable right click



While browsing through my bank account site when i used right click i observed that right click was disabled of that page, off course due to security reasons. May be they do not want to show there internal code implementation. so i was searching on web to get code which can be used to disable right click of the browser.


I got a Javascript code, which can be used to do this. Just copy-page below code in a head section of your page.


<script language="JavaScript">
   
        var message="Right click Disabled!";

        function checkIEBrowser()
        {
            if (event.button==2)
            {
                alert(message);
                return false;
            }
        }

        function checkOtherBrowser(e)
        {
            if (document.layers||document.getElementById&&!document.all)
            {
                if (e.which==2||e.which==3)
                {
                    alert(message);
                    return false;
                }
            }
        }

        if (document.layers)
        {
            document.captureEvents(Event.MOUSEDOWN);
            document.onmousedown=checkOtherBrowser;
        }
        else if (document.all&&!document.getElementById)
        {
            document.onmousedown=checkIEBrowser;
        }

        document.oncontextmenu=new Function("alert(message);return false");

    </script>


Output






Responses

0 Respones to "Javascript : Disable right click"


Send mail to your Friends.  

Expert Feed

 
Return to top of page Copyright © 2011 | My Code Logic Designed by Suneel Kumar