Permalink
Browse files

Warn when using a browser that doesn't support binary websocket messa…

…ges.
  • Loading branch information...
mdboom committed Oct 24, 2012
1 parent 5efca62 commit bf11a1378796c9f9e83988dd6e414b1e5c5699f9
@@ -7,6 +7,8 @@
onkeydown="key_event(event, 'key_press')"
onkeyup="key_event(event, 'key_release')">
<div id="mpl-div">
+ <div id="mpl-warnings" class="mpl-warnings"></div>
+
<canvas id="mpl-canvas"
class="mpl-canvas"
width="800" height="600"
@@ -1,3 +1,14 @@
+body {
+ font-family: sans;
+}
+
+.mpl-warnings {
+ display:none;
+ background:#ffdddd;
+ color:#880000;
+ border:1 #880000;
+}
+
.mpl-message {
float:right;
vertical-align:middle;
@@ -30,6 +30,14 @@ window.onload = function() {
var supports_binary = (ws.binaryType != undefined);
+ if (!supports_binary) {
+ var warnings = document.getElementById("mpl-warnings");
+ warnings.style.display = 'block';
+ warnings.textContent = (
+ "This browser does not support binary websocket messages. " +
+ "Performance may be slow.");
+ }
+
ws.onopen = function () {
ws.send(JSON.stringify(
{type: 'supports_binary',

0 comments on commit bf11a13

Please sign in to comment.