If the method succeeds, the return value is the length of the current
URL, not including the terminating null. If the method fails, the return
value is zero. To get extended error information, call
GetLastError.
The GetCurrentUrl method retrieves the URL associated
with the current document loaded in the browser instance. The URL value is
available as soon as navigation begins to a new location, so it can be
queried during or after the navigation process. This allows applications
to obtain the destination address immediately, even before the page has
fully loaded or rendered its content.
Note that the current URL may differ from the value originally passed to
Navigate. The browser engine can normalize the address,
such as adjusting letter case, expanding relative paths, or adding default
components like a trailing slash. In addition, the current URL can change
multiple times during the course of a navigation if the server issues one
or more HTTP redirects before the final document is retrieved. For this
reason, the URL returned by this method should be treated as the
authoritative location of the content currently being displayed.
This method differs from examining the document itself (for example,
by executing a script to query document.URL) because it
reflects the navigation state maintained internally by the control.
Applications should use this method to reliably track the current
location of the browser instance.
If the SetDocumentText method was called to change
the current document, the URL returned by this method will typically
be "data:text/html" which indicates it is
a local data source.