I am developing a chrome extension. I have added a new menu item in the right click menu for the extension. It works fine after installed.Then when I restart the browser, the new right click menu item disappears!But the extension work well, only the new menu item is gone! I have compared the chrome official sample for contextMenu, seems the same. I just put the create menu code in chrome.runtime.onInstalled.addListener(function() {}) like the sample does..... Any idea why this happens?
Many thanks!
updated: Add the property in the manifest file: "background": { "persistent": false, "scripts": ["background.js"] }
I would suggest moving the code to a separate function and then calling that function from both onInstalled and chrome.runtime.onStartup. The first one is invoked when you install or update, while the second one is when you reopen the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With