How Insert CSUI when Extension Action Icon is clicked
Hi, I am using React to write Plasmo. I just want to click the icon to inject CSUI when I want to use the extension. I don't want CSUI to inject automatically because I may not need to use it in most cases. Is there a good way to do this?
6 Replies
You can use this API: https://developer.chrome.com/docs/extensions/reference/scripting/#method-executeScript
Thank you for your reply, but I am unable to load files in relative paths when using this API. Just like this.
Gave +1 Rep to @louis
You will need to use it with this: https://docs.plasmo.com/framework/import
We don't transform chrome's call directly yet, but through these import schemes
perhaps one day we will make an abstraction on top of these xd...
It doesn't work. like this:
or this:
yeah it needs a relative path xD
you will need to massage the received string - console log it out try to get just the last portal :d
Something like this: