This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

title

Summary

Gets or sets the title of a Document. When the document is the main document that is shown (meaning, not of an iframe), this is usually shown to the user.

Property of dom/Documentdom/Document

Syntax

var documentTitle = document.title;
document.title = newDocumentTitle;

Return Value

Returns an object of type StringString

The current title of the document.

Examples

The following script gets the title of the document, changes the first “r” to a “t” (if there is an “r”) and sets the result as the title of the document.

// Getting the title of the document, replacing the first "r"
// with "t" and setting the result as the title of the document.
document.title = document.title.replace("r", "t");

Usage

 Use this property to get or set the title of the document.

Notes

When document is the main document that is shown to the user, most browsers show the value of this property to the user as the title of the window or page.

Related specifications

WHATWG HTML
Living Standard
HTML5
W3C Last Call Working Draft