How to send referrer when opening a link in new window using javascript?

Use the following javascript code to send referrer (http header) while opening a link in new window.
This work around is for IE 6 and above.

<script type="text/javascript">
function showNewWindow(url){
        var targetWindowName = "TestWindow";
        var wnd = window.open("",targetWindowName,"resizable=yes,scrollbars=yes,status=yes");
        var link = document.getElementById("link");
        link.target = targetWindowName;
        link.href = url;
        link.click();
        }
       
</script>
<a id="link" HREF="javascript:void(0)" style="visibility:hidden;position:absolute;"></a>
 <a href="#" onclick="javascript:showNewWindow('http://localhost:8080/tdd/newWindow.htm')"></a>

Search