Issue when communicating from a Chrome extension

Hi,

I’m currently working on a Chrome extension, where the content script will use window.postMessage to post message and on my Shiny App side I have javascript code window.addEventListener("message", function(event) {handleEvent(event)}) . When I tested running the standalone Shiny app without shinyproxy everything works fine, but when I embedded my app into shinyproxy, my app could not receive the message anymore.

One thing I’m suspecting is that accessing the DOM element window has a different meaning when using shinyproxy because I saw it’s using a iframe whose id is “shinyframe” to wrap all the Shiny UI.

Is there any way that I can still send message from a chrome extension injected javascript page to my Shiny Apps DOM, so the customized javascript code resides on the Shiny App will be able to handle the event?

Appreciate your help!

After some research, I figured out it’s because by default chrome extension won’t inject the script into iframes. So I need to set ‘all_frames’ property in the extension’s manifest to true to make it work. Here is a stack overflow post for reference.

Hi @Keqiang_Li,

Thanks for this information.
We are currently evaluating alternatives for the iframe, to allow easier embedding of ShinyProxy in other web apps.

Regards,
Frederick