Click on another extension icon and read its popup - google-chrome-extension

I'm trying to have an extension click on another extension's icon and interact with the resulting popup. It seems straightforward but I haven't found anywhere that hints at how to do it.

Related

is there any way to disable a chrome extension but without hidding the icon

i'm making a chrome extension with a toggle button that disable and enable the extension but the problem is that the extension icon hides when i click it.
i was thinking in a background extension but how I can add two extensions in the manifest.json..
The answer is simple: you can't! In a manifest.json you can only declare one extension and all the relative resources. The behaviour you want to achieve is not possible, because the icon will be removed from the chrome toolbar if an extension is deactivated, and it's not possible to change this.

Opening a Chrome extension as a pop-up using a link

I have a chrome extension installed in my browser. When I click the extension's icon in the menu bar the extension opens as a floating pop-up, as expected.
What I am trying to do is to open the extension in Chrome via a link/shortcut/whatever from another program. As a first step I've tried opening the extension from the command line, ex:
chrome "chrome-extension://abcdefghijklmnopqrstuvwxyz/index.html"
This works but the extension opens as a new tab and takes up a full broswer page instead of a just being a pop-up. Is there a way to open the extension as a pop-up on top of any open tabs?
Sadly, it's completely impossible.
There is an API in the works, but it would require at a minimum a user gesture, at a maximum explicit invocation of the extension.
So opening a link would not be enough, nor would a Native Message be.
you cant make the native extension popup to show programatically but you could use a content script that displays the popup (using the new for example) on the tab that you want.

google chrome extension: not throwing errors?

When there's a problem in the content or background script, I do not get any error messages outputted in the console. Neither will it print anything to the console via console.log('msg'). except when I do alert() explicitly.
I am copying and pasting the javascript in the console manually to catch errors, but there must be a better way of debugging a chrome extension script.
There are two consoles, one for your popup and one for the background pages. You're probably looking at the wrong one.
You can access the popup console by right clicking your extension's icon and selecting Inspect Popup and clicking the console tab in the top right.
You can access the background console by going to chrome://extensions and selecting Background Page which is to the right of Inspect views by your extension.
Make sure you're in developer mode. If you're not sure how to enter that, check out https://developer.chrome.com/extensions/getstarted

Can one Google Chrome extension have several browser action icons?

I've made an extension that adds one icon that shows a popup. But I need to show 2 icons. I've read the https://developer.chrome.com/extensions/browserAction but couldn't find a reference to any limitations on this regard. However in the manifest.json, I can only define one popup.
Is there a way for one extension to have several icons on the Chrome toolbar?
No. Each extension can have at most one browser action or page action. You could create multiple extensions that pass messages.

Making extension always opened once the user clicked in the extension icon, only close when the extension icon is clicked

I want my extension, once it is opened (clicked on the icon), to only be closed when the user click on my extension icon , like it happens when you have developer mode on and 'Inspect Pop-up', when it's in developer mode you can only close your extension after you click in the icon of it in the chrome.
I would like to make it visible until the user click on the extension icon (not any click outside) to close it but without having to have the developer mode on.
or if this is not possible I would like to at least once my extension is clicked, make my extension active so it can deal with the chrome.webRequest.onBeforeRequest.addListener()
Thanks in advance.
Take a look at background pages. As the documentation says a background page is
a single long-running script to manage some task or state
It should work if your aim is to achieve such a task.
Maybe, Desktop Notifications are some kind of decision.

Resources