iframe link opens in a new window or on the original page



 The function of iframe can embed a frame in a webpage to display the content of another webpage. Sometimes a designer will add other links to the embedded webpage. At this time, how to control the goal of the link is very important. It can be in the frame. Open a new webpage, open a new webpage in the parent layer, or open a new window directly. The link target itself is not the attribute of the iframe, but the category of the HTML a href link attribute . Designers can combine the two to determine the iframe What mode should the frame's link be opened in.


iframe link target
aimsdefinition
_blank
The original window is retained, and a new window is opened to display the linked page.
_self
Open directly in the iframe frame, and the display range of the linked webpage is in the iframe.
_parent
Open the linked page in the parent layer, directly replacing the original frame page.

The following will use test1.html to embed the framework test2.html which contains three different link targets.

Iframe link opening syntax, test1.html
<iframe src="test2.html" width="200" height="200" frameborder="1" scrolling="no"></iframe>
For each parameter of iframe, please refer to: HTML iframe frame .

Iframe link opening syntax, test2.html
<a href="link URL" target="_blank">open another window</a>
<a href="link URL" target="_self">open within the frame</a>
<a href="link URL" target="_parent">Open in parent layer</a>
Please freely set the "target URL" in the grammar. The focus is on the target parameter of the target. I will discuss it a little bit here. If the new link page to be opened is your own page, it is more reasonable to use _self or _parent for the target. If it is someone else’s webpage, you should try to use _blank to open a new window to show respect.

Post a Comment

0 Comments