summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/qmlapp/index.html16
-rw-r--r--examples/qmlapp/qmlapp.qml12
2 files changed, 21 insertions, 7 deletions
diff --git a/examples/qmlapp/index.html b/examples/qmlapp/index.html
index e5830b3..0dcc507 100644
--- a/examples/qmlapp/index.html
+++ b/examples/qmlapp/index.html
@@ -24,16 +24,26 @@
output(message);
}
);
- navigator.webChannel.execute(
+ };
+
+ function output(x)
+ {
+ document.querySelector("#out").innerHTML = x;
+ }
+
+ function send()
+ {
+ navigator.webChannel.exec(
{a:"This is a request from HTML"},
function(response) {
output(response.b);
}
);
- };
+ }
</script>
</head>
<body>
- <textarea style="width: 100%; height: 100%"></textarea>
+ <a href="javascript:send()">Go</a>
+ <div id="out"></div>
</body>
</html>
diff --git a/examples/qmlapp/qmlapp.qml b/examples/qmlapp/qmlapp.qml
index e15ff97..063a4a6 100644
--- a/examples/qmlapp/qmlapp.qml
+++ b/examples/qmlapp/qmlapp.qml
@@ -13,15 +13,19 @@ Rectangle {
txt.text = data.a;
response.send(JSON.stringify({b:'This is a response from QML'}));
}
+
+ onBaseUrlChanged: {
+ console.log(baseUrl);
+ }
}
WebView {
id: webView
+ url: "index.html?webChannelBaseUrl=" + webChannel.baseUrl ;
+ settings.developerExtrasEnabled: true
anchors.top: txt.bottom
height: 200
- settings.localContentCanAccessRemoteUrls: true
- settings.developerExtrasEnabled: true
- url: "index.html?webChannelBaseUrl=" + webChannel.baseUrl
+ width: 200
}
TextEdit {
@@ -32,8 +36,8 @@ Rectangle {
}
Text {
id: txt
+ text: "Click"
anchors.top: editor.bottom
- text: "BLA"
MouseArea {
anchors.fill: parent
onClicked: {