跪拜 Guibai
← Back to the summary

VS Code's Integrated Browser Opens Web Pages Without Leaving the Editor

VS Code Built-in Browser to Open Web Pages

VS Code can open web pages directly inside the editor — no need to switch to an external browser.

This feature is called Integrated Browser. You can open a web page directly in VS Code, or preview local HTML files.

1.jpg

Open a URL

Press:

Cmd + Shift + P

Type:

Browser: Open Integrated Browser

Then enter the address you want to open:

https://example.com

VS Code will open the web page inside the editor.

If you are developing a front-end project, you can also enter a local service address:

http://localhost:5173

This way you can write code and view the page in VS Code at the same time.

Open an HTML File

Local HTML files can also be previewed directly.

For example, right-click on index.html and select:

Open in Integrated Browser

The page will open inside VS Code.

After modifying the HTML, the preview will update accordingly — suitable for writing simple pages or temporary demos.

Difference from Live Server

Integrated Browser is responsible for "opening a web page inside VS Code."

Live Server or Live Preview is responsible for "starting a local server and auto-refreshing."

So for simple HTML preview, Integrated Browser is enough; for a full front-end project, you can first run pnpm dev, then put the local address into the Integrated Browser to open it.

Comments

Top 1 from juejin.cn, machine-translated. The original thread is authoritative.

AXin

Learned something new.