VB icon

No Refresh, No Backspace, No Right Click

Email
Submitted on: 1/5/2015 4:01:00 PM
By: Matt Khoury (from psc cd)  
Level: Advanced
User Rating: By 5 Users
Compatibility: HTML
Views: 397
 
     To disable the RIGHT CLICK, the BACKSPACE (for navigation purposes), and the REFRESH.
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
' for :No Refresh, No Backspace, No Right Click
'**************************************
Created By: Matthew J. Khoury, Copyright 2001 [Please list my name where you use this code.]
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: No Refresh, No Backspace, No Right Click
' Description:To disable the RIGHT CLICK, the BACKSPACE (for navigation purposes), and the REFRESH.
' By: Matt Khoury (from psc cd)
'
' Returns:No Right Click, No Refresh, No Backspace, and other methods to refresh or navigate back in a browser. IE v5.0 + ONLY
'
' Assumes:Please note that for this script to run effectively it is recommended that you open a new browser using script to disable the navigation, link bars, etc., etc. Also, the cool thing about this code is that the JavaScript disables itself once the cursor is in a text are box, or input box - VERY COOL!
'
' Side Effects:*************PLEASE NOTE THAT PLANET SOURCE CODE LIKES TO TRANSFORM THE CASE OF SOME PARTS OF CODE THAT IS SUBMITTED. MAKE SURE ALL OF THIS JAVASCRIPT IS LOWERCASE!*************
'**************************************

<HTML>
<HEAD>
	<TITLE>NO REFRESH, NO REFRESH, NO BACKSPACE, NO ALT-BACKSPACE, ETC., ETC..</TITLE>
<SCRIPT LANGUAGE=JAVASCRIPT>
var oLastBtn=0;
	bIsMenu = false;
	//No RIGHT CLICK************************
	// ****************************
	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.oncontextmenu = nocontextmenu; 
	document.onmousedown = norightclick; 
	//**************************************
	// ****************************
	// Block backspace onKeyDown************
	// ***************************
	 function onKeyDown() {
	 	if ( (event.altKey) || ((event.keyCode == 8) && 
	 			(event.srcElement.type != "text" &&
	 			event.srcElement.type != "textarea" &&
	 			event.srcElement.type != "password")) || 
	 			((event.ctrlKey) && ((event.keyCode == 78) || (event.keyCode == 82)) ) ||
	
	
	 			(event.keyCode == 116) ) {
	 		event.keyCode = 0;
	 		event.returnValue = false;
	 	}
	 }
</SCRIPT>
</HEAD>
<BODY onKeyDown="onKeyDown();" BGCOLOR="#639ace" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
	<TR>
		<TD><H3>NO REFRESH, NO REFRESH, NO BACKSPACE, NO ALT-BACKSPACE, ETC., ETC..</H3></TD>
	</TR>
	<TR>
		<TD>Please note that for this script to run effectively it is recommended that you open a new browser using script to disable the navigation, link bars, etc., etc..</TD>
	</TR>
</TABLE>
</BODY>
</HTML>


Other 8 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.