问题
I have a Chrome extension that works perfectly fine on version 48 but for some reason, isn't working on 49 and am not able to find anything on their release/change log.
The part that isn't working is the message passing.
Backgound page:
chrome.runtime.onMessage.addListener(function(msg, sender){
console.log(msg);
});
chrome.runtime.sendMessage({info:"this is a test"});
This will not output anything on version 49, but will on version 48.
How do I fix this?
回答1:
This is the intended behaviour. Messages were not supposed to be received by the sending page. The old behaviour was a bug. This is discussed in these bug reports: 479425 479951.
来源:https://stackoverflow.com/questions/35857606/chrome-messaging-chrome-runtime-sendmessage-not-working-on-the-newest-release-4