You are here: Reference > JavaScript > client-side > HTML DOM > properties > BaseHref (applet, object)
BaseHref property (applet, object)
Returns the base URL for the object element.
Relative paths in the document are relative to the base URL.
The base URL is the location of the current document by default, but it can be overridden by the base tag.
Use the baseURI property in Firefox, Opera, Google Chrome and Safari.
Use the baseURI property in Firefox, Opera, Google Chrome and Safari.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
String that represents the base URL.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the BaseHref property with Macromedia Flash Player.
It clearly focuses on cross-browser support only, and it isn’t standards-compliant, but there isn't any standards-compliant cross-browser way to embed a Flash application into a document with Flash Player detection.
It clearly focuses on cross-browser support only, and it isn’t standards-compliant, but there isn't any standards-compliant cross-browser way to embed a Flash application into a document with Flash Player detection.
|
||||
<head> <base href="/external/examples/common/" /> <script type="text/javascript"> function GetBaseURL () { var obj = document.getElementById ("myObject"); if ('BaseHref' in obj) { alert ("The base URL for the object:\n" + obj.BaseHref); } else { if ('baseURI' in obj) { alert ("The base URL for the object:\n" + obj.baseURI); } else { alert ("Your browser does not support this example!"); } } } </script> </head> <body> <object id="myObject" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="120" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"> <param name="movie" value="swf/flash.swf" /> <!-- Optional params --> <param name="play" value="true" /> <param name="loop" value="true" /> <param name="quality" value="high" /> <!-- END Optional --> <embed src="swf/flash.swf" width="300" height="120" play="true" loop="true" quality="high" pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" /> </object> <br /><br /> <button onclick="GetBaseURL ();">Get the base URL for the object</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments