The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> History return/return to home, linking to a second url if first history return is unavaible
bjcombs
post 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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post 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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
bjcombs
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post 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.)

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
bjcombs
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post 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. smile.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Sep 7 2007, 10:18 PM
Post #8


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 09:31 AM