1

Is there anyway to use chrome.browserAction.onClicked.addListener in background.js while using default pop.html?

It's like I'm trying to make a multipurpose extension where on clicking extension icon there comes up a popup with button nd then one of the button click should be responsible for fetching tab id. Is it possible?

Vibhu Pandey
  • 101
  • 1
  • 4

1 Answers1

0

Popup.js:-

 function sendId(){
        chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
            let tabDefination={
                tabDetail:tabs,
                txt:"tabId",
                purpose:"ScreenShot"
            }
            console.log(tabs)
            //Use runtime for sending mssg to bg scripts and tab for content.js
            chrome.runtime.sendMessage(tabDefination);
              });
        
    }

By this way we can pass the tab id freom popup.js to background script.

Vibhu Pandey
  • 101
  • 1
  • 4