Reputation: 5237
I am building a node webkit application and I would like my window title to be same as that of the title of the iframe. My iframe title keeps changing regularly (on receiving a notification). I would like my main window title also to keep track of that change and update its own title.
I extract the title of the iframe with this command with Jquery:
$("#app").contents().find("title").text()
where #app is the ID of the iframe
Upvotes: 1
Views: 1541
Reputation: 611
Maybe something like this:
newTitleListener = SetInterval(CheckForNewTitle, 200)
oldTitle = '';
function CheckForNewTitle(){
newTitle = $("#app").contents().find("title").text();
if (newTitle != oldTitle){ //Set the new title
document.title = newTitle;
oldTitle = newTitle;
}
}
Upvotes: 2
Reputation: 2827
it is as simple as putting the below code in your iframe
window.parent.document.title = "My new title";
Upvotes: 1