How to change the title of a framed document ?
In this article, we will learn about the way to change the Title of a Framed Document.
HTML Frames and Frameset: The use of Frames is to divide the window of a browser into multiple sections in which each section is loaded separately. These are used to specify which HTML document will be loaded in the particular frame. The <frameset> tag is used instead of the <body> tag in order to specify the way for dividing the browser window. It uses rows and cols attribute for specifying the area to be occupied by frames.
Note: The <frame> tag and <frameset> tag are not supported by HTML5.
Changing the Title of a Framed Document: The title shown is the title of the frameset document rather than the titles of any of the specified pages within frames. We need to link to a new frameset document in order to change the title displayed using the TARGET attribute. When we specify target=”_top”, it replaces the entire frameset.
Syntax of target attribute :
<a target="_top || _self || _blank || _parent"> ... </a>
Here, the Linked Text will act as a hyperlink that will be open in the web browser when clicked by visitors depending upon the value of the target attribute.
Values of a target attribute: This attribute refers to the target window for the URL mentioned with href attribute. Following are its possible values:
- _top: It loads the webpage into a browser window using full-body i.e. by replacing existing frames.
- _self: By default, _self is the value for the target attribute. It loads the webpage in the same window/frame from which the link is clicked.
- _blank: It loads the webpage in a new window of the browser.
- _parent: It loads the webpage in the parent window/frameset.
- framename: If you want to load the contents of the webpage into another frame then the NAME attribute is to be specified within <FRAME> element of HTML in which the contents of the linked page will be displayed. Also, there is a need to specify the target attribute of <a> element and the name of the frame in which contents will be shown.
Let’s understand with an example about the way to change the title of a framed document using TARGET attribute when its value is set to “_top”.
- Create an HTML document target_top.html for dividing the webpage into multiple sections.
- Create an HTML document target_topframe.html that illustrates the usage of the TARGET attribute.
- Create a HTML document targettop.html
- Create a HTML document welcome.html
- Create a HTML document welcome1.html
Firstly, an HTML document is created for dividing the webpage into 2 sections using the frameset cols attribute. Then target_topframe.html document is created for specifying the links that can be clicked in order to see the effect of the TARGET document. The targettop.html, welcome.html, and welcome1.html are created for displaying contents. It can be clearly seen that when TARGET=”_top” is set then the title of the frameset document gets changed.