How to know if user came from a Facebook link?

跟風遠走 提交于 2020-01-06 15:33:05

问题


If there is a link posted on Facebook to my website, and a user follows it, I would like to display custom content using PHP. I tried with the following method...

$_SERVER['HTTP_REFERER']

Facebook must block this feature because it is not working. Is there a method for this that actually works with Facebook?


回答1:


This news is a year old, yet I see they are still using it.. I post it here because It is still pretty informative The srouce of the link is https://www.facebook.com/note.php?note_id=10151070897728920

Restricting the Referrer

We still need to let the websites you navigate to know the traffic is from Facebook, but we also want to prevent them from reading the full source url. Otherwise, they could know where on the site you were when you clicked their link. In order to strike this balance, we've taken advantage of a new feature called the meta referrer, currently available in Chrome 17+ and Safari 6+. This allows us to specify how much of the source url to share with the external site via the Referer header. If you're using one of these supported browsers you can take advantage of this new feature. Otherwise, your browser will be routed to the slightly slower older system.

This change should reduce the impact of the link shim on your browsing (especially when accessing Facebook from a cellular network) and should help save around a second for a typical user.



来源:https://stackoverflow.com/questions/19485746/how-to-know-if-user-came-from-a-facebook-link

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