Solved Loading of HTML file in WebView
-
Hello,
I am trying to load the html file in WebView , but it is not able to load it.
How to load the html file in WebView
Regards,
Madhu -
Sample code please.
-
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")}
}
-
Where is the Madhu.html file ? Is it under assets ?
-
No it is not under assets, but it is in the resource file
-
Web view is some how not able to read the resource file. Can you try copying the Madhu.html under 'assets' folder and try ?
-
I tried this after adding the assets, but still it is not working the url
-
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.
-
I tried this, the url issue is resolved.
The page is loading .But the display is not getting
-
which URL u r loading inside the html file ?
-
I am loading the google Map url
-
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.
-
Ok now everthing is working fine. Thank you so much