FIX: document.referrer Property Returns Incorrect ValueLast reviewed: September 30, 1997Article ID: Q164496 |
The information in this article applies to:
SYMPTOMSThe referrer property of the document object should contain the calling page's URL. In Internet Explorer version 3.0 and 3.01, the referrer property contains the current page's URL.
CAUSEThis has been confirmed to be a problem with the object model of Internet Explorer.
RESOLUTIONTo work around this problem, you can use script code to pass the information in a cookie. The following two files, Alpha.htm and Comments.htm illustrate how to work around this problem. Alpha.htm uses a cookie named referrer to keep track of the calling page's URL. It passes this cookie to Comments.htm, which then displays the referrer.
====File Alpha.htm==== <HTML> <HEAD> <TITLE>New Page</TITLE> <SCRIPT LANGAUGE="JAVASCRIPT"> function clicked() { document.cookie='referrer='+ document.location + '; path=/'; } </SCRIPT> </HEAD> <BODY> <a href ="http://Server/Comments.htm" onClick=clicked();>Comments</a> <BR> </BODY> </HTML> ====File Comments.htm==== <HTML> <HEAD> <TITLE>New Page</TITLE> <script langauge="Javascript"> document.write("<BR><BR>cookie=" + document.cookie ); </script> </HEAD> <BODY></BODY> </HTML> STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Internet Explorer 4.0.
MORE INFORMATION
Steps to Reproduce BehaviorThe following two pages illustrate the problem. Page1.htm calls Page2.htm, which displays the referer property.
===Page1.htm=== <HTML> <HEAD><TITLE>Page 1</TITLE></HEAD> <BODY> <a href ="http://Server/Comments.htm" >Comments</a><BR> </BODY> </HTML> ===Page2.htm=== <HTML> <HEAD><TITLE>Page 2</TITLE> <script langauge="Javascript"> document.write(document.referrer); </script> </HEAD> <BODY></BODY> </HTML> Keywords : vbObjMdlIE kbprg kbbuglist Technology : kbInetDev Version : 3.0 3.01 Platform : WINDOWS Issue type : kbbug Solution Type : kbfix |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |