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

Add userInitiated into WebEngineNavigationRequest

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.8.3
    • WebEngine
    • None
    • All

    Description

      It would be nice to have userInitiated property in WebEngineNavigationRequest like in WebEngineNewWindowRequest.

      Now it's impossible to know if request has been generated by JS or by user (e.g. click on link).

       

      import QtQuick
      import QtWebEngine
      
      WebEngineView {
          Component.onCompleted: {
              loadHtml("
                  <script>
                      setTimeout(() => {
                          const link = document.createElement('a');
                          link.href = 'https://www.qt.io/';
                          document.body.appendChild(link);
      
                          link.click();
      
                          document.body.removeChild(link);
                      }, '2000');
                  </script>"
              )
      
              onNavigationRequested: (request) => {
                  console.log("navigation requested:", request.url, request.navigationType)
              }
          }
      }

       

       

      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
            alekseygraf Aleksey Ok
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes