History return/return to home, linking to a second url if first history return is unavaible |
History return/return to home, linking to a second url if first history return is unavaible |
bjcombs |
Sep 6 2007, 11:34 PM
Post
#1
|
Group: Members Posts: 7 Joined: 6-September 07 Member No.: 3,738 |
<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 |
Sep 7 2007, 11:17 AM
Post
#2
|
WDG Member Group: Root Admin Posts: 8,365 Joined: 4-August 06 From: Mountain View, CA Member No.: 3 |
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 |
Sep 7 2007, 03:33 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I don't believe there is a method called "link". Furthermore, the javascript pseudo protocol is considered evil.
|
bjcombs |
Sep 7 2007, 09:27 PM
Post
#4
|
Group: Members Posts: 7 Joined: 6-September 07 Member No.: 3,738 |
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. This post has been edited by bjcombs: Sep 7 2007, 09:30 PM |
Brian Chandler |
Sep 7 2007, 09:56 PM
Post
#5
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
"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 |
Sep 7 2007, 10:01 PM
Post
#6
|
Group: Members Posts: 7 Joined: 6-September 07 Member No.: 3,738 |
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 |
Sep 7 2007, 10:15 PM
Post
#7
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
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. |
Brian Chandler |
Sep 7 2007, 10:18 PM
Post
#8
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
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 |
Sep 9 2007, 08:41 AM
Post
#9
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Server side? He's using JS.
|
Lo-Fi Version | Time is now: 18th April 2024 - 09:31 AM |