January 21, 2008

Disable right-click on Mozilla Firefox & Internet Explorer browser

Here is a javascript code for you to disable right-click on both Internet Explorer & Mozilla Firefox. Hope this code can help you all with your coding problems.
Best Regards to All.

Code:

<script type="text/javascript">
<!-- Original: Mike McGrath (mike_mcgrath@lineone.net) -->
<!-- Website: http://website.lineone.net/~mike_mcgrath -->
<!--
var msg = "Right-Click Disabled";
var iex=(document.all);
var nav=(document.layers);
var n_6=(window.sidebar);
if(nav)window.captureEvents(Event.MOUSEDOWN);
if(n_6) document.addEventListener("MOUSEDOWN",no_click,true);
function no_click(e)
{
if((nav||n_6) && (e.which==2 || e.which==3))
{
alert(msg);return false;
}
if (navigator.appName == 'Microsoft Internet Explorer'
&& (event.button == 2 || event.button == 3))
{
alert(msg);return false;
}
}
(nav)?window.onmousedown=no_click:document.onmousedown=no_click;
//-->
</script>

Share

0 comments:

Blogger template 'PlainFish' by Ourblogtemplates.com 2008