menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Theia

Eclipse Theia - Cloud & Desktop IDE

Channels
Team

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

January 17, 2020 at 11:34am

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

January 17, 2020 at 11:34am (Edited 3 years ago)
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.

January 17, 2020 at 2:02pm
Check this answer i got, maybe it can help you out:

Trouble authoring a custom plugin!

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

January 18, 2020 at 1:25am
Hi , 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".

January 20, 2020 at 1:48am
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