Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

How to specify media type of data specified in data attribute in HTML5 ?

  • Last Updated : 31 Mar, 2021

The following approach covers how to specify the URL of the resource to be used by the object in HTML5. This can be used in pages where content from an external source is required.

Approach: We will use the data attribute of the <object> element to specify the URL of the resource that to be used for the object. The specified URL can be relative or absolute.

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

Syntax:

<object data="URL">

The below example illustrates the data attribute to specify the URL of the resource to be used by the object.



Example:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
  
    <p>Object with an image resource:</p>
  
    <object data=
    </object>
  
    <p>Object with a video resource:</p>
  
    <object data=
    </object>
</body>
  
</html>

Output:

My Personal Notes arrow_drop_up
Recommended Articles
Page :