Content of a widget should not be refreshed

Hi all, I have a custom Widget that shows up in the main area. When I open or close a workspace, the browser content is reloaded during this operation.

But, I would like the content & states within the widget to be ‘remembered’/retained and not refreshed. Any advice?

export class WebViewWidget extends ReactWidget {
    /* .... */

Here is the render method for the widget (to fill 100% of parent size)

public render(): React.ReactNode {
        this.title.label = 'TestView';
        this.title.closable = true;
        return <React.Fragment>
            <div className='web-view-content'>
                <div className="web-view-content-div">
                    <iframe src=""></iframe>

Here is css:

body, html {width: 100%; height: 100%; margin: 0; padding: 0}

.web-view-content-div {position: absolute; top: 0px; left: 0; right: 0; bottom: 0; }

.web-view-content-div iframe {
    width: 100%; height: 100%; overflow: auto; border: none;

Please advice.

You will need to implement custom retention. By default layout is preserved per origin + workspace. There is FrontendApplicationContribution.onStop which is called when a window is about to be closed. In this callback you can only use LocalStorage. Alternatively you can use other storages like backend or IndexedDB but you should store than more eagerly. You can restore in FrontendApplicationContribution.onDidInitializeLayout after the main layout is restored.