aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-13 10:48:15 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-13 10:48:15 -0800
commit09f3e4c41358e74b34b06a755372847577dce34f (patch)
tree0d7dbfddd545238356a203272b25c61234f6dd24 /src
parent3e8cb2ed7e4d7125ff3fb93da15e5dd891fd8405 (diff)
make shell.html more robust if no canvas support
Diffstat (limited to 'src')
-rw-r--r--src/shell.html10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shell.html b/src/shell.html
index 284bc8d6..87c285ea 100644
--- a/src/shell.html
+++ b/src/shell.html
@@ -19,10 +19,14 @@
// connect to canvas
var Module = {
- canvas: document.getElementById('canvas'),
- ctx2D: document.getElementById('canvas').getContext('2d')
+ canvas: document.getElementById('canvas')
};
- if (!Module.ctx2D) alert('Canvas not available :(');
+ try {
+ Module.ctx2D = Module.canvas.getContext('2d');
+ if (!Module.ctx2D) throw 'Could not create canvas :(';
+ } catch (e) {
+ print('(canvas not available)');
+ }
// The compiled code
{{{ SCRIPT_CODE }}}