diff options
author | No'am Rosenthal <noam.rosenthal@nokia.com> | 2011-08-04 16:02:15 -0700 |
---|---|---|
committer | No'am Rosenthal <noam.rosenthal@nokia.com> | 2011-08-04 16:02:15 -0700 |
commit | 53620de098e21370ab1848cd54f4db0204e68464 (patch) | |
tree | 3e8edbfe66a2c8074e2e254473b7ad0f5e404cfe /examples | |
parent | cdebb85673cce910d750abc43fa045a60e77bb8b (diff) | |
download | qtwebchannel-53620de098e21370ab1848cd54f4db0204e68464.tar.gz |
Switch to using an IFrame
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qmlapp/index.html | 16 | ||||
-rw-r--r-- | examples/qmlapp/qmlapp.qml | 12 |
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: { |