title: Permission Denied Error in Corporate Environment
body: <p>Whenever a machine with IE9 that is in our corporate domain navigates to a website (from a link) we receive a Permission Denied error dialog when any of the following window properties are accessed (styleMedia, clientInformation, screen, history, navigator, localStorage, performance, sessionStorage).  Initial page loads work but when you have a link to the same page the error occurs.</p>
  
  <p>Originally this manifested itself when the JQuery library was loaded.  The first time JQuery accessed window.navigator.userAgent a permission denied error would occur.</p>
  
  <p>All of our machines are Windows 7 64 bit Enterprise SP1.  The code below can be ran from IIS or from opening an .html file directly.</p>
  
  <p>We cannot reproduce this issue outside of our corporate domain.  We suspect some policy in our corporate environment but have been unable to determine which policy is causing this issue.</p>
  
  <p><strong>We can mitigate the issue as follows:</strong><br></p>
  
  <ul><li>Switching to IE7 or IE8 Document Mode and then back to IE9 standards Document Mode will put the browser into a state where it will work from then on.</li>
  <li>Refreshing the page will fix a single page load, but the issue will reoccur when a link is clicked and another page (could be the same one you are currently on) is loaded via a link.</li>
  <li>Navigate to the website from a machine outside of our domain.</li></ul>
  
  <p><strong>test.html</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt; 
      &lt;title&gt;Permission Denied&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;a href="test.html"&gt;Click Here&lt;/a&gt;
      &lt;script type="text/javascript"&gt;
          alert(window.navigator);
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>To see all of the properties that are inaccessible we can open this html and click the link on the page:</strong></p>
  
  <p><strong>testWindow.html</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt; 
      &lt;title&gt;Permission Denied&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;a href="testWindow.html"&gt;Click Here&lt;/a&gt;
      &lt;script type="text/javascript"&gt;
          var deniedProperties = '';
          for (var i in window) {
              var obj = window[i];
              if (obj == null) continue;
  
              try {
                  obj._____x = 1; // Attempt to access the object and set a new value on that object.
              }
              catch (e) {
                  if (e.number == -2146828218) { // Permission Denied error number.
                      deniedProperties += i + '\n';
                  }
              }
          }
  
          alert('Permission Denied:\n' + deniedProperties);
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><br><br>
  <strong>Update</strong></p>
  
  <p>This was a domain policy that had been put in place for an issue with IE6.  We discovered which policy was causing the problem by working with a support person from Microsoft who recorded and analyzed how policies were being used as I reproduced the problem on my work machine.<br><br></p>
  
  <p>Another idea you could try is to setup a child Organizational Unit in Active Directory that you have full permissions to modify.  Have it inherit all policies from corporate then use binary elimination to block policies until you find the one causing the issue.</p>