Our volunteers haven't translated this article into 한국어 yet. Join us and help get the job done!
You can also read the article in English (US).

Gets or sets the title of the document.


var docTitle = document.title;

docTitle is a string containing the document's title. If the title was overridden by setting document.title, returns that value. Otherwise returns the title specified in the markup (see the Notes below).

document.title = newTitle;

newTitle is the new title of the document. The assignment affects the return value of document.title, the title displayed for the document (e.g. in the titlebar of the window), and it also affects the DOM of the document (e.g. the content of the <title> element in an HTML document).


<!DOCTYPE html>
<title>Hello World!</title> 

alert(document.title); // displays "Hello World!"
document.title = "Goodbye World!";
alert(document.title); // displays "Goodbye World!"



This property applies to HTML, SVG, XUL, and other documents in Gecko.

For HTML documents the initial value of document.title is the text content of the <title> element. For XUL it's the value of the title attribute of the window or other top-level XUL element.

In XUL, accessing document.title before the document is fully loaded has undefined behavior (document.title may return an empty string and setting document.title may have no effect).


Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes ? Yes ? ? ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes ? Yes ? ? ?

문서 태그 및 공헌자

최종 변경: fscholz,