Object data attribute

Definition and usage

data Set or return the data attribute of the <object> element HTML <object> data Attribute Value.

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

See also:

HTML Reference Manual:HTML <object> data Attribute

HTML Reference Manual:HTML <object> Tag

Example

Get the URL of the object:

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

Try it yourself

Syntax

Return the data attribute:

objObject.data

Set the data attribute:

objObject.data = URL

Attribute value

Value Description
URL

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

Possible values:

  • Absolute URL - points to data on another website (for example, href="http://www.example.com/helloworld.swg")
  • Relative URL - Points to data within the website (such as href="helloworld.swg").

Technical Details

Return Value: A string value representing the object's URL. Returns the entire URL, including the protocol (such as http://).

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support