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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.