HTTP_REFERER blank, need alternative

空扰寡人 提交于 2019-12-03 15:06:28

In short: If the user don't want it, you will never know, where he comes from. However, a more "reliable" solution may be to add the referrer to the link from the origin site to yours. Something like

<a href="http://example.com/index.php?referrer=originId">Visit example.com</a>

This requires, that external sites cannot just link to your site, but always needs to add their personal id. If this is not possible there is not much you can do.

At all its possible, that someone may change this id too.

The referer is possibly sent in the HTTP request's header.

It is possible that the browser will not even send it, or some kind of proxy, firewall or security suite strips it out or even changes it. You cannot rely on it.

There is only one thing you can do: if it is empty, consider that you don't know the referer.

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