Important: Please read the Qt Code of Conduct -

Back navigation ("Backspace") bloked, but I can back to "about:blank" url.

  • I have a little issue, that connected with "about:blanked" url and "Backspace" button navigation. I have window with web view. I need to clear web view, when I close a window. I use function like this -> loadHtml(""), to clear web view. Then, when I open this window again, I load new page, with normal url, for example "". When I press "Backspace" button, I can successfully navigate to "about:blanked" page. Note, that i have solution applied(see code below), to block back/forward navigation, but this do not work, because there is no "navigationRequested", but always emits "urlChanged". Simple example here. Thanks for help!

    webView.onNavigationRequested: {
                if(request.navigationType === WebEngineView.BackForwardNavigation) {
                    print("onNavigationRequested", request.url)
                    request.action = WebEngineView.IgnoreRequest;

Log in to reply