gitpod-io / openvscode-server

Run upstream VS Code on a remote machine with access through a modern web browser from any device, anywhere.
https://www.gitpod.io/
MIT License
4.85k stars 422 forks source link

Cannot use window object and some javascript api. I'm not sure whether it's my wrong usage or something #482

Closed wzxinchen closed 1 year ago

wzxinchen commented 1 year ago

I am developing an extension that works well before calling the window object.

When I call window, it reports this error

Activating extension 'wzxinchen.codegame' failed: window is not defined

My understanding is that because most of the code of openvscode runs on the server, including the code of extension there is no window object?

What should I do if I need my extension to run some code on the browser side?

andreafalzetti commented 1 year ago

cc @jeanp413

jeanp413 commented 1 year ago

@wzxinchen you cannot use the window object in vscode extensions, If you are you using the webview api to render some content inside an iframe then you can use the window object there.