[ACCEPTED]-How to alter title of present tab using chrome extension-google-chrome-extension
Accepted answer
chrome.tabs.query({'active': true, 'windowId': chrome.windows.WINDOW_ID_CURRENT},
function(tab){
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.
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
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.