Re: Most portable back button in php

From: Date: Thu, 08 Aug 2002 15:00:32 +0000
Subject: Re: Most portable back button in php
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-111660@lists.php.net to get a copy of this message
Hello Henry, Just a few comments on this based on my own experience. 1. I wouldn't rely on the REFERER header that much as it is a full liability of a browser, so may not present (it is fair enough to say that modern browsers always passing it, though, except the cases below), on the other hand it may contain the URL of the 'foreign' resource which links to the certain page (containing this "back" button), so it will be misleading to go "back" to that page from your site, as the links like that are usually used for _internal_ site navigation. Yes, it will also be empty if user a) just typed the direct URL in the browser, b) came from his bookmarks, c) came via the link in the e-mail (from e-mail client). So, if you gonna use it and you want your navigation to be perfect you should carefully examine it before making a "back" button from it. 2. The javascript's history approach has the same problems plus the one when JS itself is not available, which is rare but still a case. I think that the best approach to implement the "back" buttons is to plan your site navigation very well. There are indeed very few situations when you completely unaware where the user come from to this certain page. Say, for example, you have the news articles. You know that you display them on only two pages: front page and archive page. So then when displaying an article page (let it be this address: server.com/news.php?id=118) you only need to know if it has been referred from the fron page or the archive page and build appropriate link for your "back" button: you may add one parameter like from=arc (server.com/news.php?id=118&from=arc) (I prefer shorter URLs, so I would use f=a parameter). The other thing to consider is to avoid the whole "back button" thing. Thus, on the article page, you also may distinguish if the article is fresh, so probably is on the front page now, or the old one, so it is definitely from archive. In this case you will put the link in the bottom of the page: "Other news" or "Other archived news" :) So, in other words, the better you plan your site navigation and the more you control the navigation (thus not relying on the variable factors like referer or history) the more "portable" the navigation is. In fact it is the only completely portable navigation solution I am aware of. Hope this helps, Stas Maximov. ----- Original Message ----- From: "Henry" <henry@teacake.f9.co.uk> To: <php-general@lists.php.net> Sent: Thursday, August 08, 2002 2:54 PM Subject: Re: [PHP] Most portable back button in php > Thanks, I'll have a go. In answer to the question about the browsers back > button; sometimes that may not be visible either because the user has setup > the browser that way or because a window has been opened without it. It is > accepted, however, that since javascript would be needed to open a window > without the browsers back button (if the user configuration had it showing), > then a javascript solution would be fine. > > Basically I'm just trying to be "completely" portable, a tall order I know > but easier to attain server side!! > > Thanks for you help > > Henry

« previous php.general (#111660) next »