Skip to content

Instantly share code, notes, and snippets.

@radosinsky
Last active December 9, 2021 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radosinsky/cb35cd159ac66e2d5242cdc7f57a14db to your computer and use it in GitHub Desktop.
Save radosinsky/cb35cd159ac66e2d5242cdc7f57a14db to your computer and use it in GitHub Desktop.
crx-page-title
const title = "Inactive Tab";
function changeDocumentTitle(documentTitle) {
document.title = documentTitle;
}
chrome.tabs.query({ active: false }, tabs => {
tabs.forEach(tab => {
if (!tab.url.startsWith('chrome://')) {
chrome.scripting.executeScript({
target: { tabId: tab.id },
func: changeDocumentTitle,
args: [title]
});
}
});
});
{
"name": "Page Title Changer",
"description": "Changes Title of All Inactive Tabs",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"permissions": [
"scripting",
"tabs"
],
"host_permissions": [
"<all_urls>"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment