[ACCEPTED]-How to alter title of present tab using chrome extension-google-chrome-extension

Accepted answer
Score: 11
chrome.tabs.query({'active': true, 'windowId': chrome.windows.WINDOW_ID_CURRENT},
      chrome.tabs.executeScript(tab.id,{code:"document.title = 'My lame title!'"});

The above will change the title of the currently 4 selected tab. If you allready know the 3 id of the tab you want to change, then its....

chrome.tabs.executeScript(tabId,{code:"document.title = 'My lame title!'"});

..where 2 tabId contains the tab.id of the tab that 1 you want to change.

Score: 9

The title isn't a property of the tab, but 5 of the page inside the tab. Adjusting a 4 page's title, however, is certainly possible: one 3 mechanism would be to inject a content script 2 that effected document.title:

document.title = "My awesome title!"

For details, take a look 1 at the content script documentation: http://code.google.com/chrome/extensions/content_scripts.html

More Related questions