Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • Thanks, custom events seems perfect ! Commented Oct 11, 2015 at 9:34
  • 1
    Just beware that the page's own code can spoof it, in theory. Commented Oct 11, 2015 at 9:35
  • Sure. I will add some security checks. Is it possible to get a callback or use a promise to make use of return values ? Commented Oct 11, 2015 at 9:40
  • 1
    Yes, something like a self-deregistering listener (listen for specific message, run removeEventListener with a reference to self) can be put in a promise. Commented Oct 11, 2015 at 9:41
  • 1
    Make a new question with your requirements (communication from an injected script to the content script with a response as a promise) and we'll figure something out. It'll help others as well. Commented Oct 11, 2015 at 9:58