I understand relying on Referer in the request header is not right. But my question is, why IE does not set Referer to the Request Header if I use window.location
Setting window.location is not the same as following a link on that page. It starts a new request for the page as thought the user typed the URL into the browser's address bar.
I did manage to locate a workaround:
function goTo(url)
{
var a = document.createElement("a");
if(!a.click) //for IE
{
window.location = url;
return;
}
a.setAttribute("href", url);
a.style.display = "none";
document.body.appendChild(a);
a.click();
}
It creates a link on the page and simulates a click. The result is a change in window.location and the referrer is populated.
http://ianso.blogspot.com/2006/01/referer-header-not-set-on-http.html