title: Refused to execute script - Strict Mime type
body: <p>Newbie to mediawiki, so apologies if this is a simple error.</p>
  
  <p>I have a local working fine, but on my remote (addon domain, installed in the root of that) my mediawiki install keeps giving me the console error of:</p>
  
  <pre><code>Refused to execute script from 
  'http://host.co.uk/load.php?debug=false&amp;lang=en&amp;modules=notify%2Cutil%7Cmediawiki.legacy.wikibits&amp;skin=vector&amp;version=5e0d755bcceb' 
  because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
  </code></pre>
  
  <p>that's in google chrome. But in Firefox i'm getting:</p>
  
  <pre><code>SyntaxError: expected expression, got '&lt;'
  </code></pre>
  
  <p>This error is on line  1 and points to <code>&lt;!DOCTYPE html&gt;</code>, I'm thinking because it's trying to load html, not JS?</p>
  
  <p>When I initially actioned the install, I wasn't getting any css, I solved this issue setting the <code>session.save_path</code> to a writeable directory.</p>
  
  <p>The page URL on going to the root of the site is different from local to remote. This is because my remote uses CGI which apparently breaks the short urls: see mediaWiki: <code>$wgUsePathInfo</code></p>
  
  <p><code>local: /index.php/Main_Page</code></p>
  
  <p><code>remote: /index.php?title=Main_Page</code></p>
  
  <p>I've considered the byte order issues for LocalSettings.php, by saving in vim and checking for a space or dot before <code>&lt;?php</code>, but alas no solution.</p>
  
  <p><strong>My error is described here perfectly</strong>, but being on a dedicated VPS and looking at the markup, I'm confident there is no code for tracking or advertising being injected automatically - could there be another cause?
  <a href="https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms#Missing_edit_toolbar.2C_JavaScript_not_working" rel="nofollow noreferrer">https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms#Missing_edit_toolbar.2C_JavaScript_not_working</a></p>
  
  <p>The errors do change when I switch from using suPHP as my handler. Changing to FCGI I'm able to get the firefox syntax error <code>expected expression but got &lt;</code> in google chrome and some errors printed to the page of:</p>
  
  <pre><code>Warning: Unknown: open(/tmp/sess_cf912e9c546f88005f99ad715791fe84, O_RDWR) failed: Permission denied (13) in Unknown on line 0
  
  Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
  </code></pre>
  
  <p>I am confused as whilst the least errors come from suPHP, looking in php info it says my php api is CGI/FastCGI</p>
  
  <p>I am using MediaWiki 1.26, php 5.5.3, Apache 2.2.31, CENTOS 6.7 x86_64 - any further details please just ask.</p>
  
  <p>Your help would be greatly appreciated. Apologies if I've missed anything.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The url which is giving the console error:</p>
  
  <p><code>/load.php?debug=true&amp;lang=en&amp;modules=j…notify%2Cutil%7Cmediawiki.legacy.wikibit‌​s&amp;skin=vector&amp;version=10de47153c1c</code></p>
  
  <p>returns this javascript object:</p>
  
  <p><code>mw.loader.state ({ 
     "j…notify": "missing", 
     "util": "missing", 
     "mediawiki.legacy.wikibit‌​s": "missing" 
  })</code></p>
  
  <p><strong>UPDATE 2</strong>  </p>
  
  <p>To show any details that perhaps I'm missing I show a screen on the dev tools. </p>
  
  <p><a href="https://i.stack.imgur.com/DUa4A.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DUa4A.jpg" alt="Sources Tab"></a>
  <a href="https://i.stack.imgur.com/m7Vns.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m7Vns.jpg" alt="Network Tab"></a>  </p>
  
  <p>but also, on going to the concerned url again, it's now spitting out further information. I believe the information has changed because in my desperation I did <code>composer install</code> and reploaded the <code>/vendor</code> directory:</p>
  
  <p><code>mw.loader.implement( "mediawiki.legacy.wikibits", [
      "/resources/src/mediawiki.legacy/wikibits.js"
  ] );
  mw.loader.state( {
      "j…notify": "missing",
      "util": "missing"
  } );</code></p>
  
  <p><strong>UPDATE 3</strong>  </p>
  
  <p><a href="https://i.stack.imgur.com/ZW3JI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZW3JI.jpg" alt="text/html content type on network Tab - 2"></a></p>
  
  <p><strong>UPDATE 4</strong>
  Following along the advice from @TGR, I looked at the url in the network tab giving content type text/html. The part that confused me is that it doesn't match the url giving the error. However it does return 302. Looking at the same url on my local install returns:  </p>
  
  <pre><code>mw.loader.implement( "jquery.accessKeyLabel", [
          "/resources/src/jquery/jquery.accessKeyLabel.js"
      ], {}, {"brackets":"[$1]","word-separator":" "} 
  );
  mw.loader.implement(        
      "jquery.client", [
      "/resources/lib/jquery.client/jquery.client.js"
  ] );
  mw.loader.implement( "mediawiki.RegExp", [
      "/resources/src/mediawiki/mediawiki.RegExp.js"
  ] );
  mw.loader.implement( "mediawiki.notify", [
      "/resources/src/mediawiki/mediawiki.notify.js"
  ] );
  mw.loader.implement( "mediawiki.util", [
      "/resources/src/mediawiki/mediawiki.util.js"
  ] );
  mw.loader.implement( "mediawiki.legacy.wikibits", [
      "/resources/src/mediawiki.legacy/wikibits.js"
  ] );
  </code></pre>
  
  <p>I can also confirm that those files in the above code block are present on the problematic wiki.</p>
  
  <p><strong>UPDATE 5</strong>  </p>
  
  <p>I have just done a new install of the media wiki at a different subdomain. This time rather than FTP I have SSH into the server a ran <code>wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz</code> and then <code>tar xvzf mediawiki-1.26.2.tar.gz</code>. This leaves me with folder 'mediawiki-1.26.2'. I then <code>cd mediawiki-1.26.2</code> followed by <code>mv * ../</code> so that the wiki will work from the root. The last thing to do before I can run the install, is to correct the permissions. <code>chown -R user:group *</code>  </p>
  
  <p>I then run the install which goes very smoothly. When I get to the homepage and inspect the developer console I get the same error. This is completely fresh, no .htaccess or .conf</p>
  
  <p><strong>UPDATE 6</strong><br>
  I felt as though there was some longevity in exploring the install directory. So on my own VPS I followed the install above, again moving files to the Root. I didn't get the same error, but I did get<br>
  <code>SyntaxError: expected expression, got '&lt;'</code><br>
  I then installed again but I left it in the subfolder of the root. This has not given me any errors. I then tried this on the live remote that i've been having issues with. Even installed in the subfolder this gives me:<br>
  <code>SyntaxError: expected expression, got '&lt;'</code><br>
  If I introduce a .htaccess file to rewrite the base url, such as <code>RewriteRule ^/*$ %{DOCUMENT_ROOT}/mw/index.php [L]</code>, then the issue with MIME type text/html returns. Yet adding the same rule on my other install is error free. </p>