1 Attachment(s)
The access between WebView and HTML javascript
Hi,
I have a question about WebView element.
I create a HTML file named "hfile.htm", and I use a WebView with the url property is "hfile.htm".
Now my main.qml is like:
Code:
import QtQuick 1.0
import QtWebKit 1.0
Rectangle {
width: 600
height: 400
WebView { id: webMap
anchors.fill: parent
url: "hfile.htm"
}
Rectangle { id: rec1
width: 100
height: 100
color: "red"
}
}
Can I change the color property of Rectangle rec1 from javascript in hfile.htm??
Re: The access between WebView and HTML javascript
You probably can but this probably requires a lot of work. You'd need to expose some objects to the page handled by WebView and then have appropriate scripts on the page manipulate those objects. You'd need to use the javaScriptWindowObjects attribute from WebView.