MSDN Library

IHTMLObjectElement::BaseHref Property

Retrieves a string of the URL where the object tag can be found. This is often the IHTMLBaseElement::href of the document that the object is in, or the value set by a base element.


HRESULT IHTMLObjectElement::get_BaseHref(BSTR *p);


Pointer to a variable of type BSTR that receives the URL of the object.

Return Value

Returns S_OK if successful, or an error value otherwise.


Use the IHTMLObjectElement::BaseHref property to resolve relative paths when locating an object. The following rules determine the resulting p.

  • If the object is on a page containing a base element, then the p parameter points to a BSTR with the IHTMLBaseElement::href property value.
  • If the object is on a page with javascript, vbscript, or about  protocol  URLs, then the p parameter receives a pointer to a BSTR with the value of the current page's parent page URL. This applies to IHTMLObjectElement::BaseHref property requests in iframe/ frame elements as well.
  • For all other object elements, the parameter p points to a BSTR with the IHTMLLocation::href property value for the page they are found on.

Community Additions

© 2016 Microsoft