Dofactory.com
Dofactory.com

HTML <iframe> name Attribute

The name attribute on an <iframe> tag assigns a name to that iframe.

This name is used in form submission and as a reference in JavaScript.

Example

#

A name attribute on an <iframe> element.
Click the link below to open its content in the named iframe.

<a href="https://www.wikipedia.org/wiki/Vincent_van_Gogh" 
   target="frame">Vincent Van Gogh</a> <br/> <br/>

<iframe name="frame" style="width:100%;height:450px;"
        src="https://en.wikipedia.org/wiki/Main_Page"></iframe>

Using name

The name attribute assigns a name to the iframe.

The name is used as target by <a>, <form>, and <base> elements.

The name is also the browsing context of the iframe element. The browsing context can be thought of as a mini-browser inside the browser. It has session history, a Document object, and more -- much like a browser does.

Finally, the name attribute can also be used as a reference by JavaScript.


Syntax

<iframe name="name" />

Values

#

Value Description
name String value. The iframe name.

Browser support

Here is when name 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

 Back to <iframe>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


Quick question: what's your favorite/least favorite part of Dofactory?


Guides