referrer property

Gets the URL of the location that referred the user to the current document.


HRESULT value = object.get_referrer(* p);

Property values

Type: BSTR

A BSTR that specifies the URL of the referring document.

Standards information


This property returns a value only when the user reaches the current document through a link from the previous document. Otherwise, document.IHTMLDocument2::referrer returns an empty string; it also returns an empty string when the link is from a secure site.

For example, if DocumentA.htm includes a link to DocumentB.htm, and the user clicks that link, the document.IHTMLDocument2::referrer on DocumentB.htm returns "DocumentA.htm." However, if the user is on DocumentA.htm and types DocumentB.htm into the address line or chooses the Open command from the File menu to get to DocumentB.htm, the document.IHTMLDocument2::referrer returns an empty string.