Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Pass messages from host to iframe embedded code-server #5186

Unanswered
ksdme asked this question in Q&A
Discussion options

Hey people,

I have an instance of code-server running and it is embedded in an iframe on a page with several buttons. I am trying to figure out a way to send a message/event to my custom extension in code-server from the host page when one of the buttons is clicked.

I understand that by hacking the entrypoint file of the frontend (src/vs/code/browser/workbench/workbench.html?) I can pass a message from the host frame to the vscode iframe using postMessage, but I haven't been able to find a way to propagate it from there to my extension. microsoft/vscode#138054 looks relevant but my question still stands even if I switch to web extensions.

You must be logged in to vote

Replies: 2 comments 4 replies

Comment options

Hmm...seems like that PR is relevant. Besides that, I see this in the docs, but probably not directly relevant.

What is missing from the PR you posted?

You must be logged in to vote
0 replies
Comment options

Hi @ksdme did you find a solution to your problem? I am in the same boat and just wanted to know if you were able to find a way to do it

You must be logged in to vote
4 replies
Comment options

Sorry for the late response. But, I think the way I solved this at the time was by writing an extension that exposed a REST interface. The extension would basically take commands over REST and push them into vscode events handling infrastructure. I could not solve it using simple cross frame messaging.

Comment options

Hi,
Thanks for the response!
But how would you send message from vs code to the parent iframe?

Comment options

@ksdme Is it possible to share the extension you developed. Just want to check if it is possible to adapt in our use-case

Comment options

I think one way to do this would be using WebSockets, or even maybe a shared DB like Firebase RealTime Database, pushing/pulling messages from there based on an identifier.

I'm going through the same thing right now and that's the way I see it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /