IE did not set document.referrer

2020-02-07 02:49发布

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, IE did not set document.referrer.

5条回答
叼着烟拽天下
2楼-- · 2020-02-07 02:51

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

查看更多
\"骚年 ilove
3楼-- · 2020-02-07 02:59

Try this

<script type="text/javascript" >            
function redirect(url) {
    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
        var referLink = document.createElement('a');
        referLink.href = url;
        document.body.appendChild(referLink);
        referLink.click();
    } else {
        location.href = url;
    }
}
</script>

source

查看更多
贪生不怕死
4楼-- · 2020-02-07 02:59

INFO: Internet Explorer Does Not Send Referer Header in Unsecured Situations

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.

Microsoft

查看更多
Lonely孤独者°
5楼-- · 2020-02-07 02:59

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>
查看更多
该账号已被封号
6楼-- · 2020-02-07 03:00

The easiest solution is you can use window.opener.location.href, it works fine in all browsers.

查看更多
登录 后发表回答