Phu1237 / vscode-vs-browser

Built-in browser for Visual Studio Code
MIT License
37 stars 3 forks source link

Doesn't work in WSL Ubuntu #5

Open Se7enSquared opened 1 year ago

Se7enSquared commented 1 year ago

Not sure if this is anything to do with your extension, but it would be nice if someone at least knows a workaround. I am using the Remote extension in VS Code and running my project through WSL2 Ubuntu. I have MS Edge installed on the Ubuntu system but when I open a new VS Browser instance, it's blank. Doesn't give an error or anything. Just a blank window

image

Phu1237 commented 1 year ago

First, do you use the proxy mode? It is turned off by default and you can't go to localhost web if you turn it on. Second, can you open the Inspect window by clicking the bug icon and taking a screenshot for me? The necessary information should be in there. Maybe your website is blocked by CORS. Please help me check it so I can fix it for you. Thanks!

Se7enSquared commented 1 year ago

@Phu1237 Thank you so much for helping me look into this.

do you use the proxy mode? It is turned off by default and you can't go to localhost web if you turn it on.

This is off and I also cannot visit google or any website

can you open the Inspect window by clicking the bug icon and taking a screenshot for me?

image

Phu1237 commented 1 year ago

@Se7enSquared Sorry for the missing step. Please capture log in the Console window because the error will show in there like a normal browser. Step: Open the Inspect window by clicking the bug icon > Console > Taking a screenshot for me Thanks!

Se7enSquared commented 1 year ago

Here's one of the errors image

Here's another image

Se7enSquared commented 1 year ago

Same with google image

Phu1237 commented 1 year ago

Thanks! Can you give me the development environment like language, framework, etc?. So that I can make a project on my PC to test and fix it. Because the error shows me that the 127.0.0.1 is access successful but the WebSocket (maybe auto-reload) isn't. Thanks!

Se7enSquared commented 1 year ago

I am using Python and Django on WSL Ubuntu Windows 11. I am using the Remote-WSL extension

Realized localhost server is not active in the photos. I have included a new screenshot witht the localhost activated. image

Phu1237 commented 1 year ago

Thanks, I will try to fix it on my PC. Maybe the problem is your localhost block iframe options so that the extension can't be accessed. image

Se7enSquared commented 1 year ago

@Phu1237 I really appreciate your help :) I have to admit I have no idea what my localhost block iframe options are. I should actually try to see if this happens in Windows without using the Remote WSL extension because my first thought was that it's because of using linux in windows

Se7enSquared commented 1 year ago

@Phu1237 Well my assumption was wrong! I cannot use the browser in Windows either.

This time, when not running VS Code through remote Ubuntu, it says

chromewebdata/:1 Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

In my very short bit of research I came across this - I'm sure you found it too but just in case, here it is https://stackoverflow.com/questions/6666423/overcoming-display-forbidden-by-x-frame-options#answer-7469997

Se7enSquared commented 1 year ago

@Phu1237 OK so I found out that there is also a "Simple browser" extension and I get the same result! So I guess this is not the fault of your extension. I wish I could figure it out.

Se7enSquared commented 1 year ago

One more update: VS Browser (and the "simple browser") both work when browsing https://xkcd.com/!

Phu1237 commented 1 year ago

@Se7enSquared I know about the error and I'm working on it (local proxy server). But it is not working correctly yet because my main language isn't nodejs so it will take some time to take effect. You can try the local proxy server, but it may not work as expected. Thank you for using my extension!

Se7enSquared commented 1 year ago

@Se7enSquared I know about the error and I'm working on it (local proxy server). But it is not working correctly yet because my main language isn't nodejs so it will take some time to take effect. You can try the local proxy server, but it may not work as expected. Thank you for using my extension!

Thank you.