Hi.
I am building a chrome-extension and I needed the extension to stay open until the use change/move to another tab or close the "target tab (means extension for the specific page)". But After reading so many articles, post and searches on google including stackoverflow, I didn't find any solution.
So, I left with one option and that is.... open my extension with window.open() event in backgroung.js file.
for example:
Performing task I'm trying to is:
I have a onclick button on my extension's index.html page. When I click on the button then it calls a javascript function from site.js file then that JS function calls another function which is written in background.js file then inside of that background JS function i have written a chrome.Api event which will catch activeTabId and send it to the contentScript.js file as message passing then finally my contentscript.js file have a onListener event handler which will listen to that message and send response back to me.
Problem I'm facing is:
As you can see that if I open my extension as a new window popup then it also catches the tab-id in background.js but when I send that tab-id through sendMessage()-event to the contentscript.js file where i'm listening to this meessage but for some reason it isn't hitting the reciving-message chrome-Api event handler. and also not showing any kind of error.
No alert-box and console.log-message generated from contentScript.js file.
Note:
also how many time I close my extension-window-popup and reload my url-webpage. when my extension-popup-window opens next time it always changes the tab-id of my active-tab.
one more thing open extension by browserAction button icon:
================================================
I hope that I could explain my issue thoroughly
=================================================