Latest web development tutorials
 

Object data Property

< Object Object

Example

Get the URL of the object:

var x = document.getElementById("myObject").data;

The result of x will be:

http://www.w3ii.com/jsref/helloworld.swf
Try it Yourself »

Definition and Usage

The data property sets or returns the value of the data attribute of an <object> element.

The data attribute specifies the URL of the resource to be used by the object.


Browser Support

Property
data Yes Yes Yes Yes Yes

Syntax

Return the data property:

objObject.data

Set the data property:

objObject.data=URL

Property Values

Value Description
URL Specifies the URL of the resource to be used by the object.

Possible values:

  • An absolute URL - points to data on another web site (like href="http://www.example.com/helloworld.swg")
  • A relative URL - points to data within a web site (like href="helloworld.swg")

Technical Details

Return Value: A String, representing the URL of the object. Returns the entire URL, including the protocol (like http://)

Related Pages

HTML reference: HTML <object> data attribute


< Object Object