IE has empty document.referrer after a location.replace

Looks like this is just the cost of doing business with IE users. Can’t be fixed without a hack. Working on one now. Thanks for listening.

http://webbugtrack.blogspot.com/2008/11/bug-421-ie-fails-to-pass-http-referer.html

I used the workaround to make this function. Works like a charm.

<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>

Leave a Comment