Search code examples
javascriptgoogle-chromebrowser-history

Can I get a page visitors full browser history via javascript?


I want to make a simple web app that looks at someone's browsing history and recommends new websites based on what they've viewed, but I'm running into a lot of security and non-standardization. Basically, I want to know if what I'm trying to do is even possible?

I've found that chrome has a special property called chrome.history which prompts the user for permission, then returns an array with the information, but it doesn't seem to work anymore after some sort of change to webkit. Mozilla also has something called window.history, but I'm not sure it works at all.

Can this be done? Any suggestions?


Solution

  • No, this is a security problem if this would be a possibility. You can use the $_SERVER['REFERRAL'] in php to see where the user can from before it was on you website, but only for non-httpS websites.

    If this would be a possibility, all those ad companies would not have to use tracking cookies :) They could simply check your history.

    How do you access browser history? has some shady options, all of which I dont recommend using. This is trying to get privacy sensative user-info. Even after a prompt, users can feel unsecure because they dont know exactly what they are allowing you,

    And this probally doesnt work in IE. All moderns browsers are very busy trying to upgrade privacy issues and I dont think they would like this.


    A method could be writing an browserplugin which can access it maybe, or make your website with a small topbar with a iframe where the users browses, but that is not ideal.