Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

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

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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.

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
Last Updated : 31 Mar, 2021
Like Article
Save Article
Similar Reads
Related Tutorials