Jump to content

Create a link to previous page without using back button.


poleposters

Recommended Posts

Hi all.

 

I have simple search feature on my site that displays a series of listings to user profiles.

 

The User profile has the URL www.domain.com/users.php?id=1

 

What I'd like to do is create a link that (once the viewer is done viewing the user profile) allows them to return to the search results page.

 

Which looks like (depending on what search was performed) www.domain.com/search.php?gender=male&age=22&language=english

 

Is there a way to do this?

 

If I haven't been clear, please let me know. Its been a long day.

 

Thanks in advance.

You could use JavaScript, example:

 

<a href="#" onclick="history.go(-1);">Back</a>

 

You should also make sure that they actually came from your search page though, and they didn't just click a link like www.domain.com/users.php?id=1

Thank you both. I've investigated both methods. Just have to choose the best one for my site.

 

Great point on checking that they've actually come across the page from a search page. I wouldn't of thought of that. Is that also a javascript method? I'm not too good with javascript.

yea i use both of them. but some poeple are dumb and disable javascript so u cant use that. and ive heard sometimes that the $_SERVER[HTTP_REFFERER} or what ever its called i cant remember... sometimes comes up empty even when the person has actually come from a page.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.