Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54507

QWebEngineUrlRequestInterceptor two major limitations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.0 Beta 1
    • 5.6.1
    • WebEngine
    • None
    • Mac 10.11.5, latest xcode, Qt 5.6.1 released.
    • 293929c0d9be310cb38d7dfff02f1b38ae4615c6

    Description

      QWebEngineUrlRequestInterceptor has two major limitations (as far as I can tell):

      1. if you want to handle a link click using some internal action, outside of the web browser (which is my main reason for using the interceptor – to allow web links to activate functionality within my program), there doesn't seem to be any way to tell the browser to just ignore the click. If I call block(true) then the web view shows this blockage to the user, which is definitely not what I want. Is there some way to redirect() that is the equivalent of "do nothing"?? If not, would it be possible to add an ignore() method to the QWebEngineUrlRequestInfo?

      2. The QWebEngineUrlRequestInfo contains no information about the QWebEnginePage or View that created the request – this information would be VERY helpful in appropriately responding to the click, because my program can have multiple different "project" windows open, and the links need to drive actions on the project associated with the web view where they were triggered. To work around this, I'm going to have to do something very hacky like record the web view that last got a mouse click, using an event filter, and then assume that that was the one with the intercepted link..

      3. Not so major once you figure out how to use QMetaObject::invokeMethod to send a QUrl over a queued event connection from the interceptor thread to an object living in the main thread that can properly process it: The interceptor code is run in a sub-thread, not the main thread. It might be good to highlight this a bit more in the documentation (it says it runs in the IO thread – I didn't know right away that this was NOT the main thread..), and offer a suggestion of calling invokeMethod to deliver the url to someone who can properly process it – would likely save others some time..

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            rcoreilly Randall O'Reilly
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes