title: undo preventDefault() or better way to programmatically disable collections of links
body: <p>I have a page that has event listeners for the network status. When  the network is 'offline' I want to disable any cross domain links as to go into an offline mode. I was trying to use <code>.preventDefault()</code>, however when the app comes back online I need to re-enable the links.</p>
  
  <p><strong>Event Listeners</strong></p>
  
  <pre><code>//check network status
  if(!navigator.onLine) { 
      offlineLinks(); //Offline mode function
  }
  //add event listeners for network status
  window.addEventListener('offline', function(e) {
      offlineLinks(); //Offline mode function
  }, false);
  window.addEventListener('online', function(e) {
      //need to re-enable links/Online mode
  }, false);
  window.addEventListener('error', function(e) {
      alert('Error fetching manifest: there is a good chance we are offline.');
      offlineLinks(); //Offline mode function
  });
  </code></pre>
  
  <p><strong>Function for 'de-linking'</strong></p>
  
  <pre><code>function offlineLinks() {
      $('a[href^="http"]').click(function(e) {
          e.preventDefault();
          $('#offline-dialog').dialog({
              modal: true,
              buttons: {
                  Ok: function() {
                      $(this).dialog('close');
                  }
              }
          });
      });
  }
  </code></pre>
  
  <p>I am looking for a scalable solution that won't cause lag if there are significant numbers of links on the page. Is there a simple solution to reverse the <code>.preventDefault()</code> call or a better way to accomplish this task?</p>
  
  <p><strong>Possible Solutions</strong></p>
  
  <hr>
  
  <p>My initial thoughts were either having store an array of the href values and then remove/add. I have been playing around with the HTML5 storage using <code>webdb</code>'s I could create a database for and dynamically pull the hrefs onclick...however I'm not sure if this is the best solution for this.</p>