8000 Handle slightly older versions of Firefox. · matplotlib/matplotlib@914e525 · GitHub
[go: up one dir, main page]

Skip to content

Commit 914e525

Browse files
committed
Handle slightly older versions of Firefox.
1 parent 021d74d commit 914e525

File tree

1 file changed

+8
-5
lines changed
  • lib/matplotlib/backends/web_static

1 file changed

+8
-5
lines changed

lib/matplotlib/backends/web_static/mpl.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ function ws_url(path) {
1212
}
1313

1414
window.onload = function() {
15-
if (!("WebSocket" in window)) {
16-
alert("WebSocket not supported");
17-
return;
18-
}
15+
if (typeof(WebSocket) !== 'undefined') {
16+
this.WebSocket = WebSocket;
17+
} else if (typeof(MozWebSocket) !== 'undefined') {
18+
this.WebSocket = MozWebSocket;
19+
} else {
20+
alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox ≥ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.');
21+
};
1922

2023
var message = document.getElementById("mpl-message");
2124
var canvas = document.getElementById("mpl-canvas");
2225

23-
ws = new WebSocket(ws_url("ws"));
26+
ws = new this.WebSocket(ws_url("ws"));
2427
ws.onmessage = function (evt) {
2528
if (evt.data instanceof Blob) {
2629
/* FIXME: We get "Resource interpreted as Image but

0 commit comments

Comments
 (0)
0