0

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>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by sunaruna84
0

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>

Edited by Chesterol: n/a

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.