diff options
author | No'am Rosenthal <noam.rosenthal@nokia.com> | 2011-08-04 18:15:35 -0700 |
---|---|---|
committer | No'am Rosenthal <noam.rosenthal@nokia.com> | 2011-08-04 18:15:35 -0700 |
commit | 3cb151d2373054090bd5c008ae78a69d740e3032 (patch) | |
tree | fa8c51ea33ad904fe2855259d93c05b96da82340 /examples/qmlapp/index.html | |
parent | 12572d8caf4125f4a801db56ab0ab75da60ad728 (diff) | |
download | qtwebchannel-3cb151d2373054090bd5c008ae78a69d740e3032.tar.gz |
Use navigator.createWebChannel instead of a global navigator.webChannel
Diffstat (limited to 'examples/qmlapp/index.html')
-rw-r--r-- | examples/qmlapp/index.html | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/examples/qmlapp/index.html b/examples/qmlapp/index.html index 71b08f2..d84d549 100644 --- a/examples/qmlapp/index.html +++ b/examples/qmlapp/index.html @@ -13,25 +13,27 @@ document.write('<script src="' + getWebChannelBaseUrl() + '"><' + '/script>'); function output(x) { - document.querySelector("#out").innerHTML = x; - } - - function send() - { - navigator.webChannel.subscribe( - "incoming-call", - function(message) { - output(message); - } - ); - navigator.webChannel.exec( - {a:"This is a request from HTML"}, - function(response) { - output(response.b); - } - ); + document.querySelector("#out").innerHTML += x + "<br/>"; } </script> + <script> + window.onload = function() { + navigator.createWebChannel(function(c) { + c.subscribe( + "incoming-call", + function(message) { + output(message); + } + ); + c.exec( + {a:"This is a request from HTML"}, + function(response) { + output(response.b); + } + ); + }); + }; + </script> </head> <body> <a href="javascript:send()">Go</a> |