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

Catching back button calls

Status
Not open for further replies.

WhiteTiger

Programmer
Jun 26, 2001
605
US
I know you can catch a right mouse click, and instead of displaying the menu that comes up, you can do an alternate action, like display a message box and basically disable the menu...

Is there ANY WAY to catch back/forward buttons, and disable the command and re-route it to do some javascript or vbscript, or SOMETHING?

Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
You can do an
Code:
onUnload="top.location.href='[URL unfurl="true"]http://yerdomain.com';"[/URL]
in yer body tag :)
 
Nah, I'm not looking to do an onunload...I REALLY need to catch a back button event. Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
u c, when u click back button ur current page unloads & the other one loads.. so, gerrygerry is right.. regards, vic
 
that's the thing, I dont WANT to load another page, I want to CATCH the call...

The reason is, I'm trying to incorporate the back button in some other web stuff and keep it from actually going back, but rather catching it and passing variables, etc. Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
OnUnload could be used to catch the back button (but it would also catch the browser closing, or any other page being loaded into the window).

IE probaly has something along these lines. I think i once heard about an OnBack (?) event for IE. Try researching this.

I dont know what you're really trying to do, but there is a thing in javascript that you could make a back button with:
Code:
<form>
<input type=&quot;button&quot; value=&quot;BACK&quot; OnClick=&quot;history.go(-1);&quot;>
</form>
This could be modififed to be a forward button too. -gerrygerry
geraldschafer@hotmail.com
 
I'm not looking for that...I'm looking to CATCH calls...

Mainly because of an issue with Flash not using the Back button or forward button...which a lot of people look at as a compatibility issue and therefore, I have to proove them wrong...;) Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
WhiteTiger,
I've also been looking (not too hard though) for a way to catch the back button. The best I've found is a JavaScript FAQ on the Netscape developers page that says onBack and onForward are planned for future releases of communicator, however that FAQ was last updated over two years ago.

As far as I can tell there is no way of doing it, I've seen a lot of &quot;solutions&quot; that suggest using onUnload or replacing the last entry in the history array with the current page so you just get directed straight back to the first page. But those are both really annoying and (I think) not what you're after.

What exactly do you need to do with it? I'm not sure I understand the 'compatibility issue' you're on about. If the page was purely Flash couldn't you open it in a window with no toolbars. I'm guessing that's not what you want either, but maybe if you can give a little more insight into what you're trying to achieve someone could come up with an answer.
 
I'm trying basically to integrate the back and forward buttons into a flash page. Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top