简体   繁体   中英

How to open a browser within VSCode just like another editor tab

For a VSCode extension i want open browser within VSCode not externally, wherein i can load some URL ( https://developers.redhat.com/ )

I tried looking into various options to achieve it in VScode extension, what i came across is with help of webview ie 'vscode.previewHtml' we can pass html content which would be rendered with in VSCode editor tab, but what i have is url to load. Can pass it to iframe but i can't open it in iframe

Another option is to open it in browser but it opens external browser.

what i need is to open a browser within IDE (VSCode), experience should be similar to what we get for 'vscode.previewHtml'

or as we see in IDEs like eclipse where browser window is opened right inside IDE.

As we can see below

在此处输入图像描述

Please give inputs, suggestions

为了呈现您的 html,您可以使用WebView APIhttps ://code.visualstudio.com/docs/extensions/webview

It's possible now without extension. Open command palette ( CTRL + P ) and search for "Simple Browser: Show".

This is how it looks:

vscode 浏览器标签

A deleted answer to this question included a link to a Github repo which has a very promising, but very much still in the works, browser tab inside VS code. I can't say whether or how well it works, and it has no compiled extension that I can see, but I thought this link should at least be noticed.

https://github.com/FabianLauer/chrome-vs-code

Microsoft has an extension in development, Live Preview . I use it to view html codecov reports inside of VSCODE and it at least works for that.

You just search for it in extensions and add it to VSCODE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM