HTTP 引荐来源网址以及 IE7 和 IE8
您好,我已尝试以下方法在 MSIE / IE7 和 IE8 中查找引荐来源网址,但每次都返回空白;
PHP:
<?
echo $_SERVER['HTTP_REFERER'];
?>
JAVASCRIPT:
document.write('Thanks for visiting from ' + document.referrer);
有谁知道问题可能是什么吗?我正在使用另一个域上的页面上的 document.location 来引用,并且可以与除 MSIE 之外的所有其他浏览器一起正常工作。
任何帮助都会很棒!
Hi i've tried the following to find the referrer in MSIE / IE7 and IE8 but its returning blank each time;
PHP:
<?
echo $_SERVER['HTTP_REFERER'];
?>
JAVASCRIPT:
document.write('Thanks for visiting from ' + document.referrer);
Does any know what the issue could be I'm referering using document.location from a page on another domain and work fine with all other browsers minus MSIE.
Any help would be great!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
HTTP 协议不需要 HTTP
Referer
标头:这意味着< strong>您的应用程序不能依赖
Referer
:您可以使用它来提供一些附加功能,但您的应用程序必须能够工作,即使它不存在或不正确。The HTTP
Referer
header is not required by the HTTP Protocol :Which means that you cannot rely on the
Referer
for your application : you can use it to provide some additionnal functionnality, but your application must work even if it's not there, or not correct.HTTP_REFERRER 在 IE 浏览器中不起作用,但它适用于所有浏览器,如 mozilla、safari、opera 等... Referrer 方法在 IE 中无法识别,当我们将其应用于 IE 时,它将返回 null。实际上使用 HTTP_REFERRER 本身并不是一个正确的标准,因为我们不能期望它是否有效,因为它不是标准的 HTTP HEADER。
HTTP_REFERRER does't work in IE browser it works fine for all browsers like mozilla, safari, opera etc... Referrer method doesn't recognize in IE it will return null when we apply it for IE. Actually using HTTP_REFERRER itself is not a right criteria because we can't expect it will work or not as it is not a standard HTTP HEADER.
您可以尝试以下方法:
Here's a hack you might try: