How to determine if the browser session just started or if it's a subsequent click?
问题 I would like to figure out whether the browser session is brand new (user just fired up a browser and loaded my page) or a subsequent click-through. How can this be done with JavaScript? 回答1: Instead of window.referrer try document.referrer . I got it to work for me in chrome 回答2: You can use window.referrer , although that's not a foolproof method, because some browser settings hide it for privacy purposes. It should work fine with most default settings, though. It will give you undefined if