Did you test your example? There seems to be a mistake in your JavaScript syntax, as href is a property of location, not of document itself, so the command should be written like this:
document.location.href='http://www.your-url.test'
In addition it should be said that when changing location using JavaScript, Netscape (4.x) browsers will send a referrer, Internet Explorer (5 / 6) will not. I did not yet test what Netscape 7 / Mozilla does. Most of my customers use Internet Explorer on a Windows machine.
Comment on Re: http_referer (javascript issue: location.href)