问题
I use document.referrer
to read the referrer url via JavaScript e.g. if a user clicked a google search result link and lands on my website:
http://www.google.com -> Click on search result -> redirect -> http://www.mysite.com => document.redirect returns correct referrer
Now, this works fine as long as the google search result was delivered via http but if instead httpS is used, document.referrer
is always empty:
https://www.google.com -> Click on search result -> redirect -> http:/www.mysite.com => document.redirect is empty
How can I work around this?
回答1:
When you search from https://www.google.com, websites you visit from our organic search listings will still know that you came from Google, but won't receive information about each individual query.
Please read: http://googleblog.blogspot.com/2011/10/making-search-more-secure.html
来源:https://stackoverflow.com/questions/15971264/how-can-i-get-the-correct-referer-via-javascript-if-the-referrer-uses-https