Help - Search - Members - Calendar
Full Version: History return/return to home
HTMLHelp Forums > Web Authoring > General Web Design
bjcombs
<form action="java script:history.go(-1);" method="LINK"><p align="center"><input style="WIDTH: 180px; HEIGHT: 24px" type="submit" value="Return"></form>


This code above basically creates a buttom the returns you to the previously opened page.
what i want to do is to return to the previously opened page and if that history is unavalible (as in you directly linked here and you can't "go back" on the browser) then i want it to link to another url such as "home"

any ideas?
Darin McGrew
Why would I use this back button, rather than the back function that is built into my browser, and that I know works reliably?
pandy
I don't believe there is a method called "link". Furthermore, the javascript pseudo protocol is considered evil.
bjcombs
QUOTE
Darlin McGrew: Why would I use this back button, rather than the back function that is built into my browser, and that I know works reliably?


my question wasn't about whether i should use the link. It was if there was a way to do a alternate page thing.

QUOTE
Pandy: I don't believe there is a method called "link". Furthermore, the javascript pseudo protocol is considered evil.


pandy.. i'm not that knowledgeable about "methods" in codes, but the code does work to it's expectations.


If anyone can answer my question please feel free to let me know.
Brian Chandler
"HTTP is a sessionless protocol". What that means is that there is basically no way for the server to determine absolutely "where the user came from", because a request for a page is a request for a page, and that's all. However, silly pages can offer javascript to "press the Back button", which is generally not useful, since the user already has a Back button. Sensible pages may offer a way back to somewhere *specific* to the website.

For example, if you go to my puzzle shop - e.g. http://imaginatorium.org/shop/calendar.htm and click a puzzle or two "Add to basket" , then go to the checkout, you'll see that there's a "Continue shopping" link. Clicking it takes you back to the page (Calendars) you were looking at. You can wander around the checkout, with the View basket link for example, but "Continue shopping" still goes back to the puzzle page. If you go directly to a checkout page - for example
http://imaginatorium.org/shop/ship.php?des...6+E13238+E13237

...then "Continue shopping" just takes you back to the Shop Front page.

Is this what you mean? If so, since mine just passes GET parameters around, it's transparent what's going on, and well, you could just do the same. (Of course, if you were hoping for "A code" to do this, there isn't one.)

bjcombs
QUOTE
Of course, if you were hoping for "A code" to do this, there isn't one


This is what i was wondering. Thanks.

The appication i am putting this into is a website for a theater group. with a link to a full page poster for the event. and i have a back to main page button that takes you back in the history. because this page is linked to from differant areas on the site i wanted to make sure they always ended up back where they began. and the reason i wanted the alernate address thing was incase they "opened in new window" and there wasn't any history to return to. but this answers my question, obviously not what i was hoping for but still good enough. THANKS

http://www.spooktrail.googlepages.com
pandy
QUOTE
my question wasn't about whether i should use the link. It was if there was a way to do a alternate page thing.

You aren't using a link and that's another problem.

QUOTE
pandy.. i'm not that knowledgeable about "methods" in codes, but the code does work to it's expectations.

It would work the same if you wrote HumptyDumpty.


QUOTE
If anyone can answer my question please feel free to let me know.

Even if there isn't "a code" for doing what you want there might be a half-arsed way to do it. I don't know right off, because as you previously suggested Darin and I are stoopid. Especially I. I know where to look though. If I decide to look it up I promise to tell you what I find. smile.gif
Brian Chandler
QUOTE(bjcombs @ Sep 8 2007, 12:01 PM) *

QUOTE
Of course, if you were hoping for "A code" to do this, there isn't one


This is what i was wondering. Thanks.

The appication i am putting this into is a website for a theater group. with a link to a full page poster for the event. and i have a back to main page button that takes you back in the history. because this page is linked to from differant areas on the site i wanted to make sure they always ended up back where they began. and the reason i wanted the alernate address thing was incase they "opened in new window" and there wasn't any history to return to. but this answers my question, obviously not what i was hoping for but still good enough. THANKS

http://www.spooktrail.googlepages.com


Yes, _basically_ there is no access from the server side (where you need to make the decision) to the history record in the browser. With some AJAX hacking it's probably possible, but AJAX is for PHBs, and if Google groups is anything to go by, it's quite unreliable.
pandy
Server side? He's using JS.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.