#Page/Extension Communication

1 messages · Page 1 of 1 (latest)

silent vessel
#

Explains content scripts

native perch
#

Hey thanks. Yeah I read the doc; but it's like i'm missing something... Maybe read one more time ? 😉

native perch
#

from my page script, I need to call a content script, which in turn can call an extension, which in turn can call cool APIs.

#

I can't figure out how to load a content script if it is even possible, because the documentation is about extensions, not page scripts or app or PWA.

#

Oh, and my app is a digital signage app, so there is no user interaction (if that matters in any way).

silent vessel
#

Send a message from your Kiosk app to your extension requesting the serial number, run the required APIs to get the serial number, and respond to the message with it

native perch
#

Thanks for the follow-up !
I think I got the doc right, but that there's a lot of pre-conditions for this to work.
As of now :

  1. It doesn't look like I can statically load a very simple content script with "web_accessible_resources".
  2. I still can't call chrome.runtime.sendMessage() even with "externally_connectable".
    I am obviously missing something somewhere 😉
silent vessel
#

You won't be able to call extension APIs from your web page, you can only do it from your extension.

#

You have your extension ID and your extension is running?

native perch
#

Yes, but I still have no clue on how to call it from my PWA. nothing in chrome.runtime...

native perch
#

Got it. I missed the "externally_connectable" in the extension's manifest and that magically makes chrome.runtime.sendMessage() available in the PWA.

#

Now, I am struggling to force-install my self-hosted extension in a ChromeBox. No error but no extension.
Any way to get some logs about that ?