title: Cannot detect if window is loaded
body: <p>I'm currently working on counting the number of opened tabs on my application. but my problem is it seems that my script won't detect events onload. Here is my code.
  I'm using HTML5 web storage and native js. I'm not using jQuery to understand more on native js.</p>
  
  <pre><code>(function(w) {
      function Tabz(win, key) {
          this.name = '';
          this.storageKey = key;
          if(win.name != '')
              this.name = win.name;
          else {
              var windowArr = JSON.parse(localStorage.getItem(key)) || [];
              this.name = "tabz_"+ windowArr.length; 
              win.name = this.name;
              windowArr.push(this.name);
              localStorage.setItem(this.storageKey, JSON.stringify(windowArr) );
          }
      }
  
      Tabz.prototype.getStorage = function() {
              return localStorage.getItem(this.storageKey);
      }
  
      Tabz.prototype.removeWindow = function() {
              //remove window function here
      }
  
      var newWindow = new Tabz(w, 'counter');
      window.load =  function() {
          var count = JSON.parse(newWindow.getStorage()).length;
          alert(count!); // this wont execute so that I can check the count.
      }
  
     })(window);
  </code></pre>