How to get the title of an HTML page with JavaScript?

Spread the love

Sometimes, we want to get the title of an HTML page with JavaScript.

In this article, we’ll look at how to get the title of an HTML page with JavaScript.

How to get the title of an HTML page with JavaScript?

To get the title of an HTML page with JavaScript, we use the document.title property.

For instance, we write

console.log(document.title);

to get the page title with document.title.

Conclusion

To get the title of an HTML page with JavaScript, we use the document.title property.

Leave a Reply

Your email address will not be published.