title: SCRIPT5: Access Denied on IE9 due to jQuery.min CDN file in Wordpress
body: <p>I've read quite a few other articles on the SCRIPT5: Access is Denied issue in IE9 but as far as I can tell this one is a little different and I'm not exactly sure why its happening.</p>
  
  <p>The situation arose on a Wordpress 3.4.1 install using the standard 2011 theme. I enqueued my scripts with the following function:</p>
  
  <pre><code>function my_scripts(){
      wp_deregister_script('jquery');
      wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js',null,null,true);
      wp_register_script('cycle', 'http://ajax.microsoft.com/ajax/jquery.cycle/2.88/jquery.cycle.all.js',null,null,true);
      wp_register_script('plugin', get_stylesheet_directory_uri() . '/scripts/plugin-init.js',null,null,true);
      wp_enqueue_script('jquery');
      wp_enqueue_script('cycle');
      wp_enqueue_script('plugin');
  }
  </code></pre>
  
  <p>First the <code>jquery</code> and the <code>cycle</code> scripts are both being pulled from CDNs. The <code>plugin</code> script is empty with the exception of a basic <code>cycle</code> call on a single element.</p>
  
  <p>At this point all browsers worked fine with the exception of IE9. I received the following error:</p>
  
  <pre><code> SCRIPT5: Access is denied
   jquery.min.js, line 2 character 68522 
  </code></pre>
  
  <p>I found out quickly enough that this was a cross origin issue:</p>
  
  <p><a href="https://stackoverflow.com/questions/5087549/access-denied-to-jquery-script-on-ie">Access denied to jQuery script on IE</a></p>
  
  <p><a href="https://stackoverflow.com/questions/5793831/script5-access-is-denied-in-ie9-on-xmlhttprequest">SCRIPT5: Access is denied in IE9 on xmlhttprequest</a></p>
  
  <p>I found this odd since there were no cross origin functions in my plugins. Also the issue was showing up on <code>jquery</code> itself and not my code. Tried several suggested fixes but had no luck.</p>
  
  <p>Tried some basic stuff. Moved the script directly into the footer. Tried moving it directly into the header. Tried cutting my scripts out of the equation. Pulling my hair out at this point.</p>
  
  <p>My best bet was going to be to actually see what was causing the error in the code (since I couldn't on the minified version). At this point the code was directly in the header so removed the <code>.min</code> from the script, did a refresh, and TA-DA: Everything is now working without a hitch. </p>
  
  <p>If I try to move the unminified script declaration back to the <code>my_scripts()</code> function using <code>wp_register_script</code> &amp; <code>wp_enqueue_script</code> it will fail again. If I try to move the unminified script declaration into the footer it will fail again. I did not test a local copy at the time, only the CDN versions. </p>
  
  <p>It's the same SCRIPT5 error but I unfortunately don't have the code the error is generating from handy. This was at the office the other day and I'm off for the weekend. I attempted to reproduce the events on my personal sandbox but was unsuccessful in recreating the error, which leads me to believe something unlisted may be the culprit.</p>
  
  <p>Does anyone have any idea what's going on here? Why would <code>jquery.min</code> fail where the unminified file would not? And why would the unminified file continue to fail unless its directly in the <code>&lt;head&gt;</code>?  </p>
  
  <p>Happy to supply more information, although some of it may have to wait until I return to work this coming week.  As soon as I'm able I will try to get the rest of the code posted.</p>