$_SERVER['HTTP_REFERER']

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
psurrena
Forum Contributor
Posts: 355
Joined: Thu Nov 10, 2005 12:31 pm
Location: Broolyn, NY

$_SERVER['HTTP_REFERER']

Post by psurrena »

Is there any problem with using $_SERVER['HTTP_REFERER'] as a link for back buttons?
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

I don't know, but I would use Javascript:

Code: Select all

<input type="button" value="go back" onclick="history.back();" />
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

Both will not work always. Opera for example has quite convenient means of disabling both javascript and referer [sic] logging.
Why would you want that, the browsers already have back buttons.
User avatar
psurrena
Forum Contributor
Posts: 355
Joined: Thu Nov 10, 2005 12:31 pm
Location: Broolyn, NY

Post by psurrena »

Usability. I'm working on a large site that has a lot of older users who are uncomfortable with the web. I like to give them more than one way to navigate.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

HTTP_REFERER is not set by all browsers so it is totally unreliable for use in a large scale environment.
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

psurrena wrote:Usability. I'm working on a large site that has a lot of older users who are uncomfortable with the web. I like to give them more than one way to navigate.
Well, I hate to break it to you, but users actually ignore navigation widgets. They click on links and they trackback with their back buttons.

This doesn't mean that you shouldn't provide useful navigation for those who would use it, but it would be better to implement breadcrumbs than redundant back buttons.

Just my 2% :)
User avatar
psurrena
Forum Contributor
Posts: 355
Joined: Thu Nov 10, 2005 12:31 pm
Location: Broolyn, NY

Post by psurrena »

breadcrumbs are a good idea...

A bit more information than I'd like but good non-the-less.

Thanks for all of your opinions.
Post Reply