10000 Warn when using a browser that doesn't support binary websocket messa… · matplotlib/matplotlib@bf11a13 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf11a13

Browse files
committed
Warn when using a browser that doesn't support binary websocket messages.
1 parent 5efca62 commit bf11a13

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

lib/matplotlib/backends/web_static/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
onkeydown="key_event(event, 'key_press')"
88
onkeyup="key_event(event, 'key_release')">
99
<div id="mpl-div">
10+
<div id="mpl-warnings" class="mpl-warnings"></div>
11+
1012
<canvas id="mpl-canvas"
1113
class="mpl-canvas"
1214
width="800" height="600"

lib/matplotlib/backends/web_static/mpl.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
body {
2+
font-family: sans;
3+
}
4+
5+
.mpl-warnings {
6+
display:none;
7+
background:#ffdddd;
8+
color:#880000;
9+
border:1 #880000;
10+
}
11+
112
.mpl-message {
213
float:right;
314
vertical-align:middle;

lib/matplotlib/backends/web_static/mpl.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ window.onload = function() {
3030

3131
var supports_binary = (ws.binaryType != undefined);
3232

33+
if (!supports_binary) {
34+
var warnings = document.getElementById("mpl-warnings");
35+
warnings.style.display = 'block';
36+
warnings.textContent = (
37+
"This browser does not support binary websocket messages. " +
38+
"Performance may be slow.");
39+
}
40+
3341
ws.onopen = function () {
3442
ws.send(JSON.stringify(
3543
{type: 'supports_binary',

0 commit comments

Comments
 (0)
0