Javascript – How to get the title of HTML page with JavaScript

domhtmljavascripttitle

How can I get the title of an HTML page with JavaScript?

Best Answer

Use document.title:

console.log(document.title)
<title>Title test</title>

MDN Web Docs