How can I get the correct referer via JavaScript if the referrer uses https?

筅森魡賤 提交于 2019-12-10 18:47:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!