document.referrer as an alternative to history.back()?

  • Thread starter Sander Peschier
  • Start date
S

Sander Peschier

Hi,

I was looking for an alternative to history.back() because when using
this method you just go back to the previous page, without reloading
it. Reloading the page is what you usually want when you have a
dynamic website (asp, php etc.)

This seems to work perfectly (in ie6):
<a href="#" onClick="this.href=document.referrer;">...</a>

Any comments on this?

Sander
 
T

Thomas 'PointedEars' Lahn

Sander said:
I was looking for an alternative to history.back() because when using
this method you just go back to the previous page, without reloading
it. Reloading the page is what you usually want when you have a
dynamic website (asp, php etc.)

This seems to work perfectly (in ie6):
<a href="#" onClick="this.href=document.referrer;">...</a>

Any comments on this?

document.referrer is even more unreliable than history.back(). No user
agent is required to submit the HTTP-Referer header. Submitting that header
is a security issue.


PointedEars
 
D

David Mark

Hi,

I was looking for an alternative to history.back() because when using
this method you just go back to the previous page, without reloading
it. Reloading the page is what you usually want when you have a
dynamic website (asp, php etc.)

This seems to work perfectly (in ie6):
<a href="#" onClick="this.href=document.referrer;">...</a>

Any comments on this?

Never do either. Why try to duplicate the back button?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top