I am building a Record/Playback chrome extension where the user can click a browser action to start the recording of his actions. This will insert a Content Script into the current active tab and start sending the actions to the background script. The challenging part is when the user clicks a link which opens a new window/tab and a script, the background.js
keeps a track of new tabs created using chrome.tabs.onCreated.addListener
and inserts the content script into the newly created tab if its Opener Tab ID, openerTabId
is same as the ID of the starting tab.
The whole methods seems a bit clunky to me. Is this the best way?