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

QWebEnginePage::acceptNavigationRequest always has type==NavigationTypeLinkClicked

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • 5.12.3
    • 5.11
    • WebEngine
    • None
    • 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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: