Dave Hennessey
Dave Hennessey

Reputation: 71

IE11 will not load external css from intranet

IE11 will NOT load external css from the intranet - at all. Internal css works fine. In-line css works fine. External CSS works fine on the Internet. Everything works fine in other browsers - everywhere!

When I open C:\Users\hennesse\Desktop\test.html (below) by either right-clicking and openWith->IE - or- typing into the IE location bar, I get two alerts: "internal javascript", and "external javascript" - then:

the first line is NOT red the second line is blue the third line is green

However, if I upload this to my web server, and open it with IE, the first line IS red. With Firefox and Chrome, the first line is ALWAYS red, intranet or internet.

For some reason, IE11 will not load the external CSS file on "My Computer".

Changing security settings in Internet Options->Security->Allow Active Content to run in My Computer (and rebooting) results in a prompt (or not) about Allow Active Content? But the results are the same.

This is driving me insane! -Dave

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>Test Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <link rel="stylesheet" type="text/css" href="test.css">
    <!-- 
      external file test.css contains:
      body { color: #ff0000 }
     -->

    <style type="text/css">
      .blue {
        color: blue;
      }
    </style>

    <script type="text/javascript">
      alert("internal javascript");
    </script>

    <script type="text/javascript" src="test.js">
      // external file test.js contains
      // alert("external javascript");
    </script>

  </head>

  <body>
    This should be red, but it isn't

    <p class="blue">
      This is blue
    </p>
    <p style="color:green">
      This is green
    </p>
  </body>
</html>

Upvotes: 0

Views: 2550

Answers (1)

Dave Hennessey
Dave Hennessey

Reputation: 71

In the F12 console, I found: SEC7113 "CSS was ignored due to mime type mismatch". Discussion here: 1 [MSDN]. It seems that IE9 and above "sniff" the HTTP headers for the correct MIME type, and ignore JS and CSS that have the wrong header. When it fetches files from the local filesystem, it should disable this sniffing, since there aren't any real HTTP headers.

But my particular computer is sniffing and ignoring anyway. I've searched and searched, but the mighty Internet has only yielded one other person who has this problem. She solved it by reloading the operating system. I'm not gonna do that!

I very seldom use IE for anything except a final compatibility check after I've loaded stuff to a server. Except for one personal "extension" to a Windows app that invokes IE on the user's computer. Since I'm the only using it, I just hit F12, and select IE8 mode (this shows it's the IE9-up MIME sniffing). It works fine, and since it only costs me a couple mouse clicks, it sure beats reloading the OS.

Although I didn't really solve the problem, perhaps the "sniff and ignore" info can help someone else do so. OCHI - thanks for your help. -Dave

Upvotes: 1

Related Questions