Revision control
<html>
<head>
- <script src="../../src/qwebchannel.js"></script>
<script>
+ function getWebChannelBaseUrl() {
+ var query = window.location.search.substring(1);
+ var vars = query.split("&");
+ for (var i=0;i<vars.length;i++) {
+ var pair = vars[i].split("=");
+ if (pair[0] == "webChannelBaseUrl")
+ return pair[1];
+ }
+ }
+ document.write('<script src="' + getWebChannelBaseUrl() + '"><' + '/script>');
+
window.onload = function() {
var textArea = document.querySelector("textarea");
function output(x) {
textArea.value = textArea.value + x + "\n";
}
navigator.webChannel.subscribe(
"incoming-call",
function(message) {
output(message);
}
);
navigator.webChannel.execute(
{a:"This is a request from HTML"},
function(response) {
output(response.b);
}
);
};
</script>
</head>
<body>
<textarea style="width: 100%; height: 100%"></textarea>
</body>
</html>