Quick Search for:  in language:    
disable,right,click,backspace,navigation,purp
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Java/ Javascript Stats

 Code: 220,465. lines
 Jobs: 92. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for Java/ Javascript.
Click here to see a screenshot of this code!vok - The vocabulary trainer
By Thorsten Stärk on 1/7

(Screen Shot)

Java, Calculator
By Rockwell on 1/4


Eatable Interface
By Rockwell on 1/4


Superclass Person
By Rockwell on 1/4


Draws Cube Function
By Rockwell on 1/4


Rectangle Class
By Rockwell on 1/4


Find Number of Upper and Lower Case Letters in a Command Line Argument String
By Rockwell on 1/4


anagrams
By Rockwell on 1/4


Text Reader with Tokenizer
By Rockwell on 1/4


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

No Refresh, No NAV Back*, No Right Click, No Backspace, etc.

Print
Email
 
VB icon
Submitted on: 6/19/2001 4:37:55 PM
By: Matt Khoury  
Level: Advanced
User Rating: By 10 Users
Compatibility:JavaScript

Users have accessed this code 21813 times.
 

(About the author)
 
     To disable the right click, the backspace (for navigation purposes), and the refresh.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

//**************************************
//     
// Name: No Refresh, No NAV Back*, No Ri
//     ght Click, No Backspace, etc.
// Description:To disable the right clic
//     k, the backspace (for navigation purpose
//     s), and the refresh.
// By: Matt Khoury
//
// Assumes:*Obviously for this script to
//     run effectively you MUST open up a NEW b
//     rowser window in IE using JScript. Pleas
//     e note that for this script to run effec
//     tively 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 t
//     he JavaScript disables itself once the c
//     ursor is in a text are box, or input box
//     - VERY COOL! PLEASE NOTE, THIS CODE WAS 
//     ONLY TESTED IN IE 5.0+. If you feel you 
//     can add to this code to make it better, 
//     be my guest. Send me the updated code an
//     d I will paste it right here.
//
//This code is copyrighted and has// limited warranties.Please see http://
//     www.Planet-Source-Code.com/vb/scripts/Sh
//     owCode.asp?txtCodeId=2250&lngWId;=2//for details.//**************************************
//     

<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 3 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
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
6/20/2001 10:19:37 AM:smsforce
Great code. Thanks for sharing!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/22/2001 9:19:08 PM:baroberts
Thanks. This code is the bomb!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/19/2002 4:02:45 PM:Leo
Cool thanks a mil!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/25/2002 10:44:07 AM:Jonn
Is this supposed to work in Netscape? 
Cause it doesn't.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/25/2002 12:03:20 PM:Matt
John, did you read the description?  
This only works in IE.  No Netscape.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/12/2002 7:37:07 AM:Lloyd Bottomley
This rocks! It works perfectly from the 
word go. No hassles! Your small script 
is nice and clean as well.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/24/2002 4:52:04 AM:Richard
Thanks, A good piece of code but...it 
doesn't work to lock the alt-left and 
alt-right keys (same behavior as back 
and next buttons).Is there a way to 
lock the alt key  with javascript ?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/4/2003 10:16:39 AM:
Very nice, but you forgot an 
event:
F11: in IE, this is 'to 
fullscreen mode', which will give you a 
toolbar, address bar, and links bar. 
I suspect you need something like 
|| (event.keyCode == 122) 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/7/2003 4:40:38 AM:
Add event.keyCode == 117 this also .It 
will disable F6 ,otherwise F5 won't 
work, After pressing F6 , F5 refreshes 
the page.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Java/ Javascript Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.