title: execScript try/catch oddity in IE 8
body: <p>I am using execScript within a try/catch  block to execute a piece of stringified JavaScript. If the string has a javascript error within execScript will return the following error within the catch block in IE 8 on a subsequent reload of the page:</p>
  
  <p>'Error: Could not complete the operation due to error 80020101.'</p>
  
  <p>Are there any other ways of globally evaluating javascript in IE 8 which will not throw a generic error like the one above. I know that using eval will not work since it does not evaluate the javascript in the global context.</p>
  
  <p>Below is some setup as to what my code looks like, fn is the string that is to be evaluated:</p>
  
  <pre><code>// fn is defined somewhere above this code
  
  function globalEvaluation() {
      if(document.defaultView) {
         document.defaultView.eval.call(undefined, fn);
      } else if (document.parentWindow) {
          document.parentWindow.execScript(fn);
      } 
  }
  
  return function() {
      try {
           globalEvaluation();
      } catch(e) {
         // do some error handling
         // in IE 8 I get the 80020101 error
     }
  }
  </code></pre>