1. Benoît Allard
  2. harvesim

Commits

Benoît Allard  committed 94e672f

Finnaly fixed it for IE9

  • Participants
  • Parent commits 170b31e
  • Branches default

Comments (0)

Files changed (1)

File script.js

View file
  • Ignore whitespace
   Distances are in meters.
 */
 
+// Avoid `console` errors in browsers that lack a console.
+// (like IE9 when the dev tools are not opened)
+// Code taken from https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js
+(function() {
+    var method;
+    var noop = function () {};
+    var methods = [
+        'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
+        'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
+        'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
+        'timeStamp', 'trace', 'warn'
+    ];
+    var length = methods.length;
+    var console = (window.console = window.console || {});
+
+    while (length--) {
+        method = methods[length];
+
+        // Only stub undefined methods.
+        if (!console[method]) {
+            console[method] = noop;
+        }
+    }
+}());
 
 var fields = [
     {name: 'Example 1 (square)',