diff options
Diffstat (limited to 'examples/qmlapp')
-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> |