HTTP Referer not always being passed

前端 未结 6 1962
时光说笑
时光说笑 2020-12-17 17:44

I have an application which records users visits. None of these visits are directly accessed, 100% of these visits are referred from another site.

I am passing

6条回答
  •  隐瞒了意图╮
    2020-12-17 18:28

    There are a couple of number of reasons why HTTP_REFERER might be blank.

    1. You have to understand it's an environment variable given by the browser. Meaning users can remove it or even change it, if they so intend to.
    2. Users accessing the link from a bookmark, history or by typing the link manually do not have a referer.
    3. IE has also been known to remove the referer in situations revolving around javascript. Such as window.open, window.location and even setting target="_blank" in anchors or meta refresh.
    4. Clicking an embedded link in a chat application, PDF/Word/Excel document, will also not set a referer.
    5. Using AJAX, file_get_contents, fopen and other similar functions in other languages will probably not set a referer request.
    6. cURL, fsockopen, applications that have browser-like components might not set a referer.

    There are probably more situations when this could happen, I'll update if I can think of anything that seems reasonable.

提交回复
热议问题