Hi friends

I have used this script for avoid right click in my webpage. I want to disable " savepage as" in file menu . please let me know ur suggestion.

<script language="JavaScript">
	document.onmousedown=click;
	function click() {
		if ((event.button==2)) {
		alert("Sorry you didnt access right click");
		}
	}
	</script>

As i remember I saw the answer for this question reading html tutorials. You can try this code:

<html> 
<head> 
<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 
<TITLE>JavaScriptBank.com -> JavaScript -> Security -> No Right Click</title></head> 
<body bgcolor="#000000" text="#FFFF00" link="#00FF00" vlink="#00FF00" alink="#00FF00"> 
<SCRIPT language=JAVASCRIPT> 
var oLastBtn=0; 
bIsMenu = false; 
if (window.Event) 
document.captureEvents(Event.MOUSEUP); 
function nocontextmenu() 
{ 
event.cancelBubble = true 
event.returnValue = false; 
return false; 
} 
function norightclick(e) 
{ 
if (window.Event) 
{ 
if (e.which !=1) 
return false; 
} 
else 
if (event.button !=1) 
{ 
event.cancelBubble = true 
event.returnValue = false; 
return false; 
} 
} 
document.onmousedown = norightclick; 
document.oncontextmenu = nocontextmenu;  
</SCRIPT> 

</body></html>

hi chesterol

thanks for ur reply. ur code has been working in IE but not functional in Firefox. how to solve this browser compatibility issue

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.