Skip to content

Webview functions like reload, stop, forward and loadUrl don't work #559

@RHeynsZa

Description

@RHeynsZa

So i added a webview to my angular

<webview #webview src="https://google.com/" style="width: 100%; height: 100%" allowpopups></webview>

And I reference it in my type script using:

export class AppComponent implements AfterViewInit {
    @ViewChild('webview') webview: ElementRef;
    nativeWebView: WebviewTag;

.
.
.
    ngAfterViewInit(): void {
        this.nativeWebView = this.webview.nativeElement;
        this.nativeWebView.addEventListener('dom-ready', () => {
            this.nativeWebView.openDevTools();
        });
    }
}

(sneaky edit: The nativeWebView does actually open the dev tools after this)

But if I then later try to do something like:

    reload(): void {
        this.nativeWebView.loadURL('https://myurl.com');
    }

I get the following error:

Uncaught (in promise) Error: Error invoking remote method 'ELECTRON_GUEST_VIEW_MANAGER_CALL': 
Error: ERR_FAILED (-2) loading 'https://myurl.com' at EventEmitter.t.ipcRendererInternal.send.t.ipcRendererInternal.invoke (electron/js2c/renderer_init.js:103)

Am I doing something wrong? Or is it borked?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions