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

QWebEnginePage::acceptNavigationRequest always has type==NavigationTypeLinkClicked

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Duplicate
    • Affects Version/s: 5.11
    • Fix Version/s: 5.12.3
    • Component/s: WebEngine
    • Labels:
      None
    • Environment:
      Qt 5.8 from git
      QtWebEngine 4d56afd

      Description

      When doing Ctrl+click on a link or using javascript window.open, createWindow() is called, followed by acceptNavigationRequest() on the new page. In a web browser (konqueror) we need to be able to differenciate between the two use cases, e.g. to implement things like a confirmation messagebox ("this website wants to open a popup, accept/deny?").

      With QtWebkit we used the NavigationType enum passed to acceptNavigationRequest(), if it was NavigationTypeLinkClicked it was a user action (no confirmation), if it was NavigationTypeOther it was triggered by javascript.

      With QtWebEngine the API looks the same, but the type enum is always NavigationTypeLinkClicked, it seems.

      Testcase:

        <a href="javascript:setTimeout(window.open('http://www.davidfaure.fr'), 3000)">window.open delayed</a>
      

      QtWebKit says:

      NewWindowPage::acceptNavigationRequest: url: QUrl("http://www.davidfaure.fr/") ,type: 5 (NavigationTypeOther)
      

      QtWebEngine says:

      NewWindowPage::acceptNavigationRequest: url: QUrl("http://www.davidfaure.fr/") , type: 0 (NavigationTypeLinkClicked)
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              allan.jensen Allan Sandfeld Jensen
              Reporter:
              dfaure_kdab David Faure
              Votes:
              8 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes