Jump to content

history.previous


SyncViews

Recommended Posts

I want to use the history object to find the url of the last page a user visited.

 

I tried "document.write(history.previous);" but I get a blank string even though history.length shows there are 6 items in the history...

 

I'm new to js so have no idea why I am getting a blank string so any help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/85055-historyprevious/
Share on other sites

Access to those elements is restricted for security reasons. If you want to track where users are coming from (and you are using PHP), you can use the $_SERVER['HTTP_REFERER'] variable.

 

More info can be found here: http://www.informit.com/articles/article.aspx?p=29878&seqNum=4&rl=1

Link to comment
https://forums.phpfreaks.com/topic/85055-historyprevious/#findComment-433785
Share on other sites

I want to use the history object to find the url of the last page a user visited.

 

I tried "document.write(history.previous);" but I get a blank string even though history.length shows there are 6 items in the history...

 

I'm new to js so have no idea why I am getting a blank string so any help would be appreciated.

document.write("<a href='javascript:history.go(-1)'>Back</a>");

Link to comment
https://forums.phpfreaks.com/topic/85055-historyprevious/#findComment-433947
Share on other sites

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.