YouTube not showing as a referrer?

百般思念 提交于 2019-12-07 12:57:02

问题


I've been tracking referrers to my site and storing it a session to be used in some reports when they do certain actions.

To get the referrer, I just do $_SESSION["s1"] = $_SERVER["HTTP_REFERER"];

It seems to work for everything except YouTube. Clicking a link on YouTube generates a blank referrer. What could cause this? Does YouTube do something to the headers? Does opening a new window lose the referrer info?


回答1:


I came across this same issue today. Even though this question is 5 years old it came up first on Google when I searched for the cause; so I am going to answer it here for others who stumble across it.

The issue is not so much related to YouTube and is actually caused by the browser. Some browsers will remove the referer header when traffic switches protocols from HTTPS to HTTP. To maintain the referer header you would have to link it to a URI that uses HTTPS as its protocol.



来源:https://stackoverflow.com/questions/10391107/youtube-not-showing-as-a-referrer

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