dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


"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
Thanks for your registration, follow us on our social networks to keep up-to-date