I'm changing from MV2 to MV3. Thought it would be easy, but for some reason my web scraping script isnt being triggered.
I have only 2 scripts, popup.js and payload.js
payload.js parses elements and gets values.
popup.js does the actual processing.
Previously, in MV2 the payload script was executed on load by:
window.addEventListener('load', (evt) => {
chrome.extension.getBackgroundPage().chrome.tabs.executeScript(null, {
file: 'payload.js'
});
});
However, now in MV3 this is no longer working and for the life of me i cant figure out how to make it run.
The payload.js basically sends these across to the popup.js like so:
chrome.runtime.sendMessage({name: PRICE_LABEL, content: price});
The popup.js intercepts the call and does the data processing:
chrome.runtime.onMessage.addListener(async function (field, content) {
// do stuff here
});
Thats pretty much all i'm trying to do, but i cant figure out how to.