HTML | DOM Object data Property

The HTML | DOM Object data Property is used to set or return the value of the data attribute of an <object> element. The data attribute is used to specify the URL of the resource which will be used by the object.


  • Return the data property.
  • It is used to set the data property. = URL

Property Values: It contains the value i.e URL which specifies the URL of the resource.

  • Absolute URL: It is used to point another website.

  • Relative URL: It points to link within a website.

Example: This Example returns a data Property.





<!DOCTYPE html>
        <object id="myobject" 
        <h2>DOM Object data Property</h2>
        <button onclick="Geeks()">
            Click it
        <p id="gfg" 
        function Geeks() {
            // Accessing Object element. 
            var x =
                "gfg").innerHTML = x;


Before Clicking On Button:

After Clicking On Button:

Supported Browsers:

  • Google Chrome
  • Mozilla Firefox
  • Edge
  • Safari
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.