Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Possible to disable BACK navigation???

Status
Not open for further replies.

futantbirth

Technical User
Mar 20, 2003
4
0
0
US
Specifically, to remove the use of BACKSPACE, and the BACK menu item. Any help would be greatly appreciated!!! Thanks!
 
A colleague of mine provided the following.

<script language="JavaScript">
/* This function forces the back button on IE to just refresh the current page*/
<!--
javascript:window.history.forward(1);
//-->
</script>
 
I should have added that this must be added to the HEAD of your HTML document.
 
easily defeated if you dont surf with javascript turned on.
 
I see a lot of requests for this type of function and I can't for the life of me understand why anyone would want to do this. It is a real irritation to click the back button and have nothing happen. Please don't try to take away the inherent functions of my browser. Just my opinion...

There's always a better way. The fun is trying to find it!
 
tviman, usually because, they are using it on a page that has a form to be filled out and by Pressing the back button, they essentially can screw up their server side scripting or "timed" out the page that they entered from.

Honestly, that would be bad coding if they did that.
 
Honestly, that would be bad coding if they did that.
Exactly! That's why the server side scripting should cater for ANY user action, not just the expected user response.

I'm with tviman. IMHO, I would find it extremely annoying if the back button was disabled.

futantbirth - what are you trying to do? Is it indeed a form validation problem? Enlighten us please.

Pete.


Web Developer &amp; Aptrix / Lotus Workplace Web Content Management (LWWCM) Specialist
w: e: Pete.Raleigh(at)lclimited.co.uk
 
It is the request of my client to not allow users to back up through a certain portion of their site.

Yes, I did counsel my client on better alternatives.

No, I will not do this to the point that I lose money for it.
 
futantbirth,

Have you tried using META tags to expire the pages so that if a visitor does press the "back" button they won't see anything?

Code:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate, no-store">

Not sure if it will do what you want, but it's worth a try.

Hope this helps.
-Ron

P.S. If you are generating these pages dynamically then you may have more options for expiring a page (or not caching it).

We all play from the same deck of cards, it's how we play the hand we are dealt which makes us who we are. -Me

murof siht edisni kcuts m'I - PLEH
 
Ya, actually I did recommend a more dynamic solution. Therein lies another issue, however... my client wants to achieve the same results without a more costly solution, though a known better solution. I'll try that meta code... I'd much rather modify the cache than strong-arming navigation. Thanks for the tip.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top