tags:

views:

206

answers:

4

For example,

if user goes to google -> example.com -> newwebsite.com

If he goes back to example.com, the http-referrer page will still be google.com

How can I detect that he went to newwebsite.com

+1  A: 

I believe that the back button will send the HTTP headers that were sent to the site the first time around, since it's not really a new visit.

Say you displayed an error page if the user's http-referrer was newwebsite.com. The first time they visited, they would get your site. If they went to newwebsite.com, and then hit back (meaning they wanted to go back in time, through their browser history, not load the page again with new headers), then they would get an error page, and the nature of the back button would be defeated. I don't know if this inspires that behavior or not, it just makes sense to me that way.

Maybe it's possible, but it would be entirely browser-dependent. Why do you need this functionality, anyway? Newwebsite isn't referring the user to your website at all, there's no connection between the two at all--it just happens to be the last page that the user visited.

Carson Myers
i would like to keep track if the user liked an external link or not, and whether they return to my page from those websites.
chris
well, I suppose you could interpret two subsequent requests from the same location to be a return -- but how does this gauge whether or not the user 'liked' the link? If I click a link, see it, and then click back, how do you know whether I liked it and bookmarked it, or didn't like it and returned to the page?
Carson Myers
oh, good point. i assumed that people who didn't like the site return to mine, but i think you're right.
chris
+1  A: 

I don't believe that this is generally possible. You could pull tricks with javascript on your site so that all the links navigated from there could be detected and recorded, but once the users off your site you've got no control.

If you provided the browser, ie. developed your one yourself, then you could choose to expose the browser history via an api.

http://jeremiahgrossman.blogspot.com/2006/08/i-know-where-youve-been.html

Describes a technique for exploiting the browsers agreement to modify links to indicate that they have been traversed (eg. changing the colour of the link) so that visited sites can be detected, however this only works for a pre-declared set of links, it's not a generally applicable approach.

My feeling is that attempts to hide the nature of browsers - users can hop around all over the place - tend to lead to unsatisfactory 79% solutions that mystify users.

What problem are you actually trying to solve?

djna
+2  A: 

If a visitor uses the back button, the page might be loaded from browser cache. In that case, no referrer is sent. Using google analytics, you can see how many visitors came from a given web site. This might give you some information.

jao
+1 for cache and no referrer! depending on a browser settings it can load everything from the cache; check content for expiration and load a part; load everything from server passing the cache -- every way works with referrers very differently!!
abatishchev
A: 

You can use sessions inorder to track the path of pages.it really works wwell.try it.

Nandini
............... how?
Shoban
That would only work if you control ALL the visited pages, or most of them - on today's web, this is usually not the case.
Piskvor
that will work.if the user visits a page named page1,he can redirect to another page with a passing parameter.this passing parameter will be stored in a session variable.then by comparing the session variable we can track the path.it is possible.
Nandini