heyanshukla
heyanshukla

Reputation: 669

Is it possible to trace browser history in a PHP code?

I want to know that whether on a php page we can get browser history? Suppose I want to display a php page if a specific link on that browser has been visited earlier otherwise a blank page is to be displayed. Is it possible to do so??

Upvotes: 0

Views: 8166

Answers (3)

BugFinder
BugFinder

Reputation: 17868

As it is your own site, you can store a session variable to confirm they went there, do something like

session_start();
$SESSION["VisitedMySpecialPage"]=time();

and then in the checker page

session_start();
if (isset($SESSION["VisitedMySpecialPage"]))
{
 // check here it was within say the last hour..
}

Upvotes: 5

AbstractProblemFactory
AbstractProblemFactory

Reputation: 9811

Well, there was workaround to this problem some time ago, I don't know which browser still can do it:

  • place <a> tag with href attr to link what you are interested on your
  • inspect <a> node (via JS), if that link got :visited pseudo class send
  • send result via ajax to server

Upvotes: 1

Willem D&#39;Haeseleer
Willem D&#39;Haeseleer

Reputation: 20200

You can track what pages where visited on your own domain, but you can't check what other domains he visited. You can check the referer header to see what site he came from , but that's only 1 site and isn't very reliable.

Upvotes: 1

Related Questions