Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

browserAction.setTitle not working

I am trying to add a number that will show up when you mouseover the chrome extension icon, and this number will change as the script runs. However, when I add

 chrome.browserAction.setTitle({
    title:'it works!';
});

into my content.js file, the entire script stops working. My manifest.json file currently looks like this:

{
  "manifest_version": 2,
  "name": "sampleName",
  "version": "1.0",
  "permissions": [
      "storage"
        ],
   "browser_action": {
    "default_title": "not working"
   },
  "content_scripts": [
    {
      "matches": [
        "https://www.sample.com"
      ],
  "js": ["content.js"]
    }
  ]
}

Everything works perfectly when I remove the chrome.browserAction.setTitle statement from content.js, so something about that statement is breaking my entire script.

like image 897
Zach Avatar asked Aug 15 '26 18:08

Zach


1 Answers

I have encountered a similar issue even though I am calling chrome.browserAction.setTitle in the background script.

It was resolved by removing the default_title from browser_action in manifest.json. It works as expected since then.

like image 165
qazwsx000xswzaq Avatar answered Aug 18 '26 07:08

qazwsx000xswzaq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!