Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

371
Vistas
CSS not loading because MIME type coming as "text/html" only in Internet Explorer

I am having the .NET MVC application running on IIS 7. My page is rendering properly and styles are working fine in Chrome and Firefox but in IE 10 the css is not loading and in Network tab I am seeing it is coming as "text/html" and giving 406 Http Unacceptable code. My css file path is correct and I am rendering like below

<link href="/Content/css-app/bootstrap.min.css?v=20210924122520" rel="stylesheet" type="text/css" />

Can somebody please help? I have been searching through the internet from more than 2 days.

IE 10 Network log

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

From what I have found you can configure mime types in IIS, if that is possible for you:

web.config

<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".css" mimeType="text/css" />
      <mimeMap fileExtension=".js" mimeType="text/javascript" />
    </staticContent>
  </system.webServer>
</configuration> 

You may also want to add the charset (apply the correct one for you if it's not utf-8):

<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".css" mimeType="text/css; charset=utf-8" />
      <mimeMap fileExtension=".js" mimeType="text/javascript; charset=utf-8" />
    </staticContent>
  </system.webServer>
</configuration> 

If it's not that maybe the response is really an HTML page with an error text?
It might be an HTML page in disguise.

Credits:

  • web.config example on SO
  • mimemap docs
  • iis configuration files
about 4 years ago · Juan Pablo Isaza Denunciar

0

You probably did not add the appropriate mime type on the server side and the browser is sending it with "text/css".

You can always get the content in plain text and put it in a style tag.

var xhtp = new XMLHttpRequest();
xhtp.open("GET","/Content/css-app/bootstrap.min.css?v=20210924122520");
xhtp.setRequestHeader("Content-Type","text/plain");
xhtp.onload = function(){
    let stylTag = document.createElement("style");
    stylTag.textContent = this.responseText;
    document.head.appendChild(stylTag);
};
xhtp.send();
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda