Offscreen + Messaging API issue
Hello, I am trying to create an offscreen document for copying text to clipboard. I am trying to follow some of the examples I found in this issue: https://github.com/PlasmoHQ/plasmo/issues/527.
In my
this is the offscreen.ts file:
Heres my offscreen.html:
But, when I try this, I get this error:
Am I supposed to put the message handler in a different place or create the offscreen document in a different file? I would really appreciate if someone could help me fix this.
In my
background.ts file, I am trying to send a message to my offscreen.ts file like this:this is the offscreen.ts file:
Heres my offscreen.html:
But, when I try this, I get this error:
Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist. Which I'm guessing means it can't find the message handler. Am I supposed to put the message handler in a different place or create the offscreen document in a different file? I would really appreciate if someone could help me fix this.