Revision control

<html>
<head>
<script>
document.write('<script src="' + (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/]+)/.exec(location.search)[1]) + '/webchannel.js/createWebChannel"><' + '/script>');
function output(x)
{
document.querySelector("#out").innerHTML += x + "<br/>";
}
</script>
<script>
window.onload = function() {
createWebChannel(function(c) {
c.subscribe(
"foobar",
function(message) {
output(message);
}
);
- c.exec(
- JSON.stringify({a:"This is a request from HTML"}),
- function(response) {
- output(JSON.parse(response).b);
- }
- );
+ window.send = function() {
+ c.exec(
+ JSON.stringify({a:"This is a request from HTML"}),
+ function(response) {
+ output(JSON.parse(response).b);
+ }
+ );
+ };
+ window.send();
});
};
</script>
</head>
<body>
<a href="javascript:send()">Go</a>
<div id="out"></div>
</body>
</html>