Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Why iframe triggered QWebPage::acceptNavigationRequest(url, QWebEnginePage::NavigationTypeLinkClicked, false), not QWebEnginePage::NavigationTypeTyped?

Why iframe triggered QWebPage::acceptNavigationRequest(url, QWebEnginePage::NavigationTypeLinkClicked, false), not QWebEnginePage::NavigationTypeTyped?

Scheduled Pinned Locked Moved Unsolved QtWebEngine
2 Posts 2 Posters 965 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dscyw
    wrote on last edited by dscyw
    #1

    I am using qt5.10.1 webengine module. I encountered a weird thing that iframe triggered QWebPage::acceptNavigationRequest(url, QWebEnginePage::NavigationTypeLinkClicked, false). More detailed as follow.

    QUrl url = QUrl::fromLocalFile(":/resource/index.html");
    QWebEngineView *view = new QWebEngineView;
    QWebEnginePage *page = new QWebEnginePage;
    view->setPage(page);
    view->load(url);  
    

    QWebPage::acceptNavigationRequest is triggered as QWebEnginePage::NavigationTypeLinkClicked for its type and "www.google.com.hk" for its url then. I think QWebEnginePage::NavigationTypeTyped is the right type.

    index.html is something like

    <!DOCTYPE html>
    <html>
        <head>
        </head>
        <body>
            <textarea id="output">a test html</textarea><br/>
    		<iframe width=900, height=500, src="http://www.google.com.hk"><iframe>
        </body>
    </html>
    

    Is there something wrong with my index.hmtl? If not, why does it happen and how can I disable this trigger?

    L 1 Reply Last reply
    1
    • D dscyw

      I am using qt5.10.1 webengine module. I encountered a weird thing that iframe triggered QWebPage::acceptNavigationRequest(url, QWebEnginePage::NavigationTypeLinkClicked, false). More detailed as follow.

      QUrl url = QUrl::fromLocalFile(":/resource/index.html");
      QWebEngineView *view = new QWebEngineView;
      QWebEnginePage *page = new QWebEnginePage;
      view->setPage(page);
      view->load(url);  
      

      QWebPage::acceptNavigationRequest is triggered as QWebEnginePage::NavigationTypeLinkClicked for its type and "www.google.com.hk" for its url then. I think QWebEnginePage::NavigationTypeTyped is the right type.

      index.html is something like

      <!DOCTYPE html>
      <html>
          <head>
          </head>
          <body>
              <textarea id="output">a test html</textarea><br/>
      		<iframe width=900, height=500, src="http://www.google.com.hk"><iframe>
          </body>
      </html>
      

      Is there something wrong with my index.hmtl? If not, why does it happen and how can I disable this trigger?

      L Offline
      L Offline
      llas
      wrote on last edited by
      #2

      @dscyw I'm facing the same issue. Have you found a solution?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved