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 value = object.get_BaseHref(* p);

Property values

Type: BSTR

the URL of the object.


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 or vbscript, or is about IHTMLImgElement::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

© 2015 Microsoft