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
Due to security reason we do this thing, i used this code along with Https protocol.
to know about Https protocol click here
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
Https protocol
Due to security reason we do this thing, i used this code along with Https protocol.
to know about Https protocol click here