资源被解释为样式表,但在控制台中以MIME类型text/html错误进行传输 [英] Resource interpreted as Stylesheet but transferred with MIME type text/html error in console

查看:3215
本文介绍了资源被解释为样式表,但在控制台中以MIME类型text/html错误进行传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的Angular App中包含flexslider,并且在包含flexslider css文件后出现以下错误

I am trying to include flexslider in my Angular App and getting a following error after i included the flexslider css file

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/controlpanel/users/css/style.css". 

我检查了我的文件位置是否正确,但是正确

I checked to see if my file location was not correct but it is correct

推荐答案

我遇到了同样的问题.好吧,我只是试图使用servlet加载欢迎的jsp页面,该页面的标头中包含一个.css文件.

I've faced the same issue. Well, I was just trying to use a servlet to load welcome jsp page, which contains a .css file in header.

<head>
   <link rel="stylesheet" type="text/css" href="css/base.css">
</head>

我遇到了同样的错误资源被解释为样式表,但以MIME类型text/html传输:" http://localhost:8080/webapp/css/style.css "

And I got the same error "Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/webapp/css/style.css"

当我在chrome中使用开发人员工具时,在网络"标签下,点击我的Web应用的登录网址" http://localhost:8080/webapp/"

When I used developer tools in chrome, under 'Network' tab, two calls were made when hit my webapp's landing url "http://localhost:8080/webapp/"

我在web.xml中将默认的servlet网址从"/"更改为"/index"

I changed my default servlet url from "/" to "/index" in web.xml

<servlet-mapping>
    <servlet-name>NextServlet</servlet-name>
    <url-pattern>/index</url-pattern>
</servlet-mapping>

然后将"./"添加到href,

And then added "./" to href,

 <head>
   <link rel="stylesheet" type="text/css" href="./css/base.css">
</head>

有效.

这篇关于资源被解释为样式表,但在控制台中以MIME类型text/html错误进行传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆