Recently I've noticed an issue with IE header when we use window.location Javascript construct. Generally, most common way of opening a website through Javascript is window.location as below


function general(url)
{
window.location=url;
}

But if you're doing any logic based on the header REFERER in the target page that will not work in IE, since IE browser will not pass REFERER header when you use window.location.

I was in the same position and tried to find a solution for that, here is what I've done to enable the REFERER header for IE. Here is the solution:


function special(url)
{
var anchor = document.createElement("a");
if(!anchor.click) {
//Providing a logic for Non IE
window.location = url;
return;
}
anchor.setAttribute("href", url);
anchor.style.display = "none";
document.getElementById("body").appendChild(anchor);
anchor.click();
}
If you've sometime, why don't you read my other Javascript articles/programs.