Open In App

How to create a nested webpage in HTML ?

Improve
Improve
Like Article
Like
Save
Share
Report

When the content of one completely different webpage is embedded into another webpage, it is called a nested webpage. In simple words, a webpage that is inside another webpage of a completely different domain. In this article, we are going to learn how to create a nested webpage. There are two methods to create a nested webpage.

Using <iframe> tag:

The iframe in HTML stands for Inline Frame. The “iframe” tag defines a rectangular region within the document in which the browser can display a separate document, including scrollbars and borders. An inline frame is used to embed another document within the current HTML document

Syntax:

<iframe src="URL"></iframe>

It can take the height and width of the inline frame as an attribute.

Example: Implementation of the <iframe> tag.

HTML




<!DOCTYPE html>
<html>
   <head></head>
   <body>
      <h1>
        Creating a Nested Webpage using
        'iframe' Tag: Geeksforgeeks
      </h1>
 
      <iframe src="https://www.geeksforgeeks.org"
              height="500px" width="1000px">
      </iframe>
   </body>
</html>


Output:

Using <embed> tag:

The <embed> tag in HTML is used for embedding external applications which are generally multimedia content like audio or video into an HTML document. But other raw HTML content can be embedded using this tag. We can use this feature to create a nested webpage.

Syntax:

<embed src="URL" type="text/html" /> 

Example: Implementation of the <embed> tag

HTML




<!DOCTYPE html>
<html>
   <head></head>
   <body>
      <h1>
        Creating a Nested Webpage using
        'embed' Tag: Geeksforgeeks
      </h1>
 
      <embed src="https://www.geeksforgeeks.org"
          type="text/html" />
   </body>
</html>


Output:

The website can prevent you from embedding their content due to copyright issues. So it is mandatory to have proper permission and authorization before using another webpage as a nested webpage inside your website.



Last Updated : 12 Jan, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads