Files

49 lines
916 B
HTML

<!DOCTYPE html>
<head>
<style type="text/css" media="screen">
.container { width: 100%; height: 600px; overflow: scroll; }
</style>
</head>
<body>
<div>
<h2 id="header"></h2>
<button onclick="quitBox('quit')">Close</button>
</div>
<hr>
<div class="container">
<pre id="log"></pre>
</div>
<script>
function quitBox(cmd) {
if (cmd=='quit') {
//open(location, '_self').close();
//ws.send("\x03");
self.close();
}
return false;
}
document.getElementById('header').textContent = "Host: " + window.location.hostname;
// setup websocket with callbacks
var ws = new WebSocket('ws://' + window.location.hostname + ':88/');
ws.onopen = function() {
};
ws.onclose = function() {
// close();
};
ws.onmessage = function(event) {
document.getElementById('log').textContent += "event.data" + "\n";
};
</script>
</body>