HTML target="_top"

A target="_top" attribute specifies that the the linked page or form response will be opened in the topmost frame which is the full browser tab and window.

Example

#

A target="_top" on an <a> tag. This link resides inside an <iframe>.
Clicking the link opens the linked page in the current browser tab (the top).

Note:  Without target="_top" the linked page would open inside the iframe.

<iframe width="300" height="100"
        style="border:3px dashed #ef4444;padding:30px; 0 0 30px"
        srcdoc="<a target='_top' href='/html'>HTML Tutorial</a>">
</iframe>

Using target="_top"

The target attribute specifies where the linked page or form response will be opened.

The target="_top" value opens the page in the top frame which always is the full browser tab/window.

If no higher level frame is detected, it will be displayed on the current frame instead.


Syntax

<tagname target="_top" />

Elements that accept target

These elements accept the _top value on the target attribute.

Elements Description
<a> Specifies an anchor link -- see example above
<area> Creates clickable areas inside an image map.
<base> Sets the base URL for all relative URLs on a page or site..
<form> Specifies an HTML form.

Browser support

Here is when target support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

Guides