Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Is it possible to open link in the default browser from QtWebView(Qml)?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to open link in the default browser from QtWebView(Qml)?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 2.0k Views 1 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.
  • A Offline
    A Offline
    Aronax
    wrote on last edited by Aronax
    #1

    Hello, I want to open link in the browser from QtWebView(Qml). This approach was unsuccessful for me. When I click on link I get error to console:

    [9888:9376:1203/170259.011:ERROR:frame_sink_provider_impl.cc(34)] No RenderWidgetHost exists with id 6 in process 3
    
    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Can you show the code on how you are doing it ? It helps to check.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Aronax
        wrote on last edited by Aronax
        #3

        The qml code:

            WebView {
                id: webView
                url: homeViewUrl
        
                width: parent.width
                height: parent.height
            }
        

        The html code:

        <!DOCTYPE html>
        <html>
          <head>
            <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
            <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
          </head>
          <body oncontextmenu="return false">
            <a href="https://www.google.com/"  
              onclick="window.open('https://www.google.com/', 
                                 'newwindow', 
                                 'width=300,height=250'); 
                      return false;"
            >Link</a>
          </body>
        </html>
        
        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Which platform are you trying ? Can you try with simple example like the following ?

          Window {
              visible: true
              width: 640
              height: 480
              title: qsTr("Hello World")
              WebView {
                     id: webView
                     url: "http://www.google.com"
                     width: parent.width
                     height: parent.height
              }
          }
          

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Aronax
            wrote on last edited by Aronax
            #5

            Windows. But the goal is to run also on Android and iOS. Yes that example is working. The WebView loads the page. The problem is that I want to open link in the default browser and it's not working. (The Link is in the loaded .html in the WebView.)

            For example if I open this file:

            <!DOCTYPE html>
            <html>
              <head>
                <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
                <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
              </head>
              <body oncontextmenu="return false">
                <a href="https://www.google.com/"  
                  onclick="window.open('https://www.google.com/', 
                                     'newwindow', 
                                     'width=300,height=250'); 
                          return false;"
                >Link</a>
              </body>
            </html>
            

            with my browser and press the link - the other browser window opens(not tab). I want the same functionality, but using qml WebView(when I press link it should open new default browser window).

            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