In WebEngineView how can ignore a request ?



  • On WebView it’s possible to do:
    @
    onNavigationRequested: {
    // detect URL scheme prefix, most likely an external link
    var schemaRE = /^\w+:/;
    if (schemaRE.test(request.url)) {
    request.action = WebView.AcceptRequest;
    } else {
    request.action = WebView.IgnoreRequest;
    // delegate request.url here
    }
    }
    @
    but I can’t see on the documentation a way to do the same with the new WebEngineView
    Is It possible ?

    Thanks,
    Gianluca.



  • We're facing the same problem now. We haven't implemented a proper solution yet, but one option that we discussed was using JavaScript for this purpose. (The other is changing the website we're having this issue with, but that is probably not a solution for you.)

    I am not a JavaScript developer myself so i don't know the specifics, but apparently this is something that is possible in the HTML/JavaScript world of the web, and so you may just need a different approach.

    Hopefully someone else can give more specific advice, but maybe this is already enough to get you on the right track.



  • Anyone ever solve this issue? I wound up using QML to take advantage of the onNavigationRequested event to hijack (and cancel) the navigation, which solves this immediate problem. However, this solution is not working for me as a whole since I cannot figure out how to run javascript in the WebEngineView when it is created in QML, which is my second requirement. :(


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.