javascript IE 没有设置 document.referrer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13681156/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IE did not set document.referrer
提问by Muhammad Imran Tariq
I observed it closely by debugging in IE that; IE did set document.referrer
if I submit form or click any link but when I redirect to another page using javascript window.location
, IEdid not set document.referrer
.
我通过在 IE 中调试仔细观察了它;IE浏览器没有设置document.referrer
,但是当我到另一个网页使用,如果我提交表单或点击任何链接javascript window.location
,IE浏览器did not set document.referrer
。
回答by Jonathan de M.
回答by Anjith K P
INFO: Internet Explorer Does Not Send Referer Header in Unsecured Situations
信息:Internet Explorer 在不安全的情况下不会发送 Referer 标头
When linking from one document to another in Internet Explorer 4.0 and later, the Referer header will not be sent when the link is from an HTTPS page to a non-HTTPS page. The Referer header also will not be sent when the link is from a non-HTTP(S) protocol, such as file://, to another page.
在 Internet Explorer 4.0 及更高版本中从一个文档链接到另一个文档时,当链接从 HTTPS 页面到非 HTTPS 页面时,不会发送 Referer 标头。当链接来自非 HTTP(S) 协议(例如 file://)到另一个页面时,也不会发送 Referer 标头。
回答by Sachindra Dubey
The easiest solution is you can use window.opener.location.href, it works fine in all browsers.
最简单的解决方案是您可以使用 window.opener.location.href,它适用于所有浏览器。
回答by polin
IE doesn't Support referrer while you try to send it in pop-up or use window.location.You can send your referrer in many ways. But you will not have it if you try to get it in server side if while change location through a JS popup or change location in JS while using IE, for IE built-in security issue. Check window or window.open property.you can go here
当您尝试在弹出窗口中发送或使用 window.location 时,IE 不支持引用。您可以通过多种方式发送引用。但是,如果您尝试在服务器端获取它,如果同时通过 JS 弹出窗口更改位置或在使用 IE 时更改 JS 中的位置,则您将不会拥有它,因为 IE 内置安全问题。检查 window 或 window.open 属性。你可以去这里
回答by user3778362
Try this:
试试这个:
<script type="text/javascript">
$("#button").click(function(){
window.open("about:blank", "win_name", "height=370,width=365, top=50, left=90, scrollbars=yes,resizable=no,menubar=no");
sForm = '<form action="url.php" method="post" target="win_name">';
sForm += '</form>';
//alert(sForm);return;
$(sForm).appendTo('body').submit();
return;
});
</script>