Ben Elgar
Ben Elgar

Reputation: 785

How do you get the title of an html page in Javascript

I've currently got a website in which a div is updated to the contents of the same div on another page via Javascript, allowing a seamless transition between webpages, but how do I make the title of the webpage update to the title of the new webpage?

Further clarification: I know how to change the title of the webpage, but how do I get the title of a specified webpage?

Upvotes: 2

Views: 1859

Answers (2)

var newWindow = window.open("www.site.com","Title","options...");
newWindow.title = "rename here";

Upvotes: 1

Pointy
Pointy

Reputation: 413682

You can get/set document.title.

document.title = "New Title For Page";

Upvotes: 4

Related Questions