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. Loading of HTML file in WebView
Forum Updated to NodeBB v4.3 + New Features

Loading of HTML file in WebView

Scheduled Pinned Locked Moved Solved QML and Qt Quick
13 Posts 2 Posters 2.9k Views
  • 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.
  • M Offline
    M Offline
    Madhu M S
    wrote on last edited by
    #3

    Please find the code below:
    Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    WebView
    {

        anchors.fill: parent
    

    // url:"/home/shrinidhi/Madhu/WebViewExample/Madhu.html"
    url:"Madhu.html"
    // url:Qt.resolvedUrl("/Madhu.html")

    }
    

    }

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #4

      Where is the Madhu.html file ? Is it under assets ?

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

      1 Reply Last reply
      2
      • M Offline
        M Offline
        Madhu M S
        wrote on last edited by
        #5

        No it is not under assets, but it is in the resource file

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by dheerendra
          #6

          Web view is some how not able to read the resource file. Can you try copying the Madhu.html under 'assets' folder and try ?

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

          1 Reply Last reply
          1
          • M Offline
            M Offline
            Madhu M S
            wrote on last edited by
            #7

            I tried this after adding the assets, but still it is not working the url

            1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by
              #8

              Just try this

              WebView {
              anchors.fill: parent
              url : Qt.resolvedUrl("file:///android_asset/Madhu.html")
              }

              Please note there is NO 's' in asset. It is confusing but it works.

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

              1 Reply Last reply
              2
              • M Offline
                M Offline
                Madhu M S
                wrote on last edited by
                #9

                I tried this, the url issue is resolved.

                The page is loading .But the display is not getting

                1 Reply Last reply
                2
                • dheerendraD Offline
                  dheerendraD Offline
                  dheerendra
                  Qt Champions 2022
                  wrote on last edited by
                  #10

                  which URL u r loading inside the html file ?

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

                  1 Reply Last reply
                  2
                  • M Offline
                    M Offline
                    Madhu M S
                    wrote on last edited by
                    #11

                    I am loading the google Map url

                    1 Reply Last reply
                    1
                    • dheerendraD Offline
                      dheerendraD Offline
                      dheerendra
                      Qt Champions 2022
                      wrote on last edited by dheerendra
                      #12

                      hmm. Google map requires Key. Not sure whether you have right key with you.

                      Can you try loading some other web-site like http://www.cnn.com or http://www.pthinks.com ?

                      Just check if it works.

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

                      1 Reply Last reply
                      2
                      • M Offline
                        M Offline
                        Madhu M S
                        wrote on last edited by
                        #13

                        Ok now everthing is working fine. Thank you so much

                        1 Reply Last reply
                        1

                        • Login

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