dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language:
Expertise: Intermediate
Jun 22, 1999

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


"Disable" the Browser's Back Button

While there is no way to specifically disable the back button from within the browser, you can shortcut the navigation to another page. The trick is to catch the onbeforeunload event of the window:

 
<script language="VBScript">
dim curPage
dim canNavigate
canNavigate=false
curPage=document.location

function window_onbeforeunload()
	if not canNavigate then
		window.navigate curPage
	end if
	canNavigate=true
end function
</script>

Whenever anyone attempts to leave the page, the browser will nudge the user back. You can disable this functionality in code by setting the global variable canNavigate to true.

Kurt Cagle
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date