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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set where clicking back goes to?...Is this possible

Status
Not open for further replies.

gameon

Programmer
Feb 23, 2001
325
GB
Hi. I am building a web site with lots of frames. I need to disable the back button - which I'm told can't be done.

I have been told that you can determine where the back button actually takes you.

What I would like to do is set the 'back' location to be the same as that of the current frame and also pop-up an alert box saying that back is disabled and to only use the site navigation.

Can anyone help?

Cheers,

Matt
 
Hi I have now added the code

window.location.replace(the current page loaction);

to the code. But when I load the page it just keeps on reloading its self.

Can anyone help?
 
>>I have been told that you can determine where the back button actually takes you.
It's not true. You cannot affect on stardart toolbar buttons of a browser.
What you can do, however, is to use history.go() function, applied to a link (text or image):

<a href=&quot;javascript:history.go(-2);alert('your alert message')&quot;>link</a>

In this case you'll get the page two clicks away from your current one. Negative argument says to move backwards, positive - forward in browser history list.

Please think about the alert message - it will become annoying after several clicks.

One more thing. Navigation is one of the basic usability issues. Never affect navigation process - let the user do what HE wants and not what do YOU want. If not, you'll lose your visitors simultaneously.

Andrew | starway@mail.com
 
i think you can use history.replace but i'm not really sure
you can also detect if history.go(-1)!=document.location and do whatever you want to, but i agree with Andrew, it is a dangerous thing to do (personnaly i ran off sites that want me to use THEIR navigation, THEIR plug ins or whatever)
 
Perhaps you need to use location.replace to load pages into various frames as opposed to href's. The back button shouldn't record any of these changes.

Matt.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top