Skip to content
Browse files

Adds failure message for browsers not supporting websockets

  • Loading branch information...
1 parent cda2313 commit 764581a0083e93e265db586142df61d48f40bfcd @madadam committed Sep 29, 2011
Showing with 28 additions and 8 deletions.
  1. +21 −8 public/app.js
  2. BIN public/sadcat.jpg
  3. +7 −0 views/styles.scss
View
29 public/app.js
@@ -335,14 +335,15 @@
}
- $(document).ready(function() {
- ideas.initialize()
- indicator.initialize()
- newIdeaButton.initialize()
- search.initialize()
- trash.initialize()
-
- ideas.load()
+ var initializeSocket = function() {
+ if (!window.WebSocket) {
+ if (window.MozWebSocket) {
+ var WebSocket = MozWebSocket
+ } else {
+ $("body").empty().html("<p class=\"fail\">This browser does not support WebSockets and that sucks.</p>")
+ return
+ }
+ }
var host = document.location.hostname
var protocol = document.location.protocol.replace(/http(s?):/, "ws$1:")
@@ -370,5 +371,17 @@
break
}
}
+ }
+
+ $(document).ready(function() {
+ ideas.initialize()
+ indicator.initialize()
+ newIdeaButton.initialize()
+ search.initialize()
+ trash.initialize()
+
+ ideas.load()
+
+ initializeSocket();
})
})(jQuery)
View
BIN public/sadcat.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
7 views/styles.scss
@@ -311,4 +311,11 @@ body {
}
}
+p.fail {
+ background: url(/sadcat.jpg) no-repeat top center;
+ padding-top: 280px;
+
+ text-align: center;
+}
+

0 comments on commit 764581a

Please sign in to comment.
Something went wrong with that request. Please try again.