Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE did not set document.referrer

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.

like image 951
Muhammad Imran Tariq Avatar asked Dec 03 '12 10:12

Muhammad Imran Tariq


3 Answers

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

like image 143
Anjith K P Avatar answered Nov 14 '22 23:11

Anjith K P


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

like image 37
Jonathan de M. Avatar answered Nov 14 '22 21:11

Jonathan de M.


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

like image 21
polin Avatar answered Nov 14 '22 22:11

polin