How to display a website in a theia tab from an extension?

Hi, I’m just starting with Theia and just want to experiment / develop simple extensions to better understand how it works. So sorry for the newbies question: I would like to display in a new tab a external website (For instance I would like to display google homepage in a new tab). I succeeded to do it in a plugin (via a new command which is creating a webview panel rendering an iframe on google), but I don’t figure out how to do it in an extension. Starting from ‘yo theia-extension widget’ sample, currently my extension is adding a widget in the side bar. My widget contains a simple button, and I want to open the new tab on button click but don’t find how to do it. I would really appreciate to get some help. Thanks.

[original thread by Thierry Le Gal]

[loladmebrah]

Check this answer i got, maybe it can help you out: https://spectrum.chat/theia/general/trouble-authoring-a-custom-plugin~74db2acf-c51b-4826-acc4-c32fa9781514https://spectrum.chat/theia/general/trouble-authoring-a-custom-plugin~74db2acf-c51b-4826-acc4-c32fa9781514

[Thierry Le Gal]

Thanks for your help, this was the info I was looking for. It works now using mini-browser extension.

[riyuejian]

Hi @thierry-le-gal , you can set your custom widget in a tab by set set " defaultWidgetOptions: { area: ‘main’ }," . This code in constructor of your xxxContribution. Also, you can reference the “getting started extension”.

You sure be aware though that many websites are not allowing embedding by using CSP policies (https://developer.mozilla.org/ru/docs/Web/HTTP/CSP).

i.e. the mini-browser is not suitable for generic browsing, but more for previewing code