Chrome extension: sendMessage doesn't work

后端 未结 3 1558
说谎
说谎 2021-01-06 09:28

I\'ve already read the documentation from Google on \'message passing\' a few times and have probably looked at over 10 other questions with the same problem and already tri

3条回答
  •  一生所求
    2021-01-06 10:13

    Careful reading of this answer may help you. Every point there applies to your problem.

    Your problem is in when your main script is executing, and when your content scripts are. You need to ensure there is a content script listening before you send a message to it, in worst case injecting it programmatically.

    And to get it working in a popup, follow KAdot's answer.

提交回复
热议问题