Resource interpreted as Stylesheet but transferred with MIME || DevTools failed to parse SourceMap:
最近在学SpringBoot,在整合Thymeleaf的时候,配置拦截器。教学上讲SpringBoot已经做好了静态资源映射,所以不需要特地去做排除拦截
以下代码就是我在做登录拦截的时候配置的拦截。
@Override
public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginHandleInterceptor()).addPathPatterns("/**")
.excludePathPatterns("/","/index.html","/user/login");
} 一开始,资源都能映射,一切感觉都OK,上午搞定后吃个饭,下午继续搞的时候,发现有的样式突然失效了。
在谷歌浏览器检查问题的时候,发现了这句话,
DevTools failed to parse SourceMap: -------------------------------------------------------------------------------------------
普遍解释是
在现在写网站的时候,如果有很多的javascript文件,拿ASP.NET NVC来说,
在渲染内容到客户端浏览器的时候,如果你使用一些Bundle类的话,能够合并并且压缩那些js文件,
并且去除其中的空格等元素,从而减小文件的容量,提高网页的反应速度。
但是这样一样造成的问题就是在浏览器端无法对js文件进行调试,因为进过压缩的文件很紧凑,没有空格与换行。
概括来讲,SourceMap就是如何把压缩后的js代码映射成格式化代码的方法。
当你在Production环境部署代码的时候,伴随着压缩与优化话的js代码,
还要有一个包含原始js代码的sourcemap文件。当客户端浏览器Chrome在收到这个压缩后的js文件后,
它会自动的去寻找服务器上相关的sourcmap文件并把压缩的js代码转换成格式规范的js代码。 以上摘抄与https://blog.csdn.net/sundacheng1989/article/details/51118865
----------------------------------------------------------------------------------
总之所有的解决办法大概都是这幅图
但是我在关掉开发者工具额这两个选项后,出现了另一个报错
Resource interpreted as Stylesheet but transferred with MIME 这个错误百度了一下,各种解决办法。头都大了。然后在恼火中一直点击
Resource interpreted as Stylesheet but transferred with MIME后面的地址链接,一直被我的拦截器拦住跳回登录
页的时候。在想是不是拦截器的问题。注释了一下,发现就是这逼在搞鬼。我也不知道SpringBoot到底有没有对静态资源自动映射。
总之我把拦截的代码加上了红字的代码就OK了。
@Override
public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginHandleInterceptor()).addPathPatterns("/**")
.excludePathPatterns("/","/index.html","/user/login","asserts/**","webjars/**");
}
以上是我的解决方法
Resource interpreted as Stylesheet but transferred with MIME || DevTools failed to parse SourceMap:的更多相关文章
- odoo 错误 Resource interpreted as Stylesheet but transferred with MIME type application/x-css:
odoo8 页面内容显示一半, web 控制台显示错误 Resource interpreted as Stylesheet but transferred with MIME type ap ...
- Resource interpreted as Stylesheet but transferred with MIME type text/plain
今天碰到了Resource interpreted as Stylesheet but transferred with MIME type text/plain 这个错误. 原因:在web中配置了f ...
- Django 导入css文件,样式不起作用。Resource interpreted as Stylesheet but transferred with MIME type application/x-css
笔者今天在模板中加载css文件时,发现 css样式能够下载再来却无法起作用,而且,图片.js都能够正常使用. 并且 浏览器提示: Resource interpreted as Stylesheet ...
- 样式加载不出来,浏览器控制台报错:Resource interpreted as Stylesheet but transferred with MIME type text/html
写登录的时候出现的问题,样式时好时坏,浏览器控制台看到的信息是: Uncaught SyntaxError: Unexpected token <Resource interpreted as ...
- Resource interpreted as Stylesheet but transferred with MIME type text/html: css失效
异常信息: Resource interpreted as Stylesheet but transferred with MIME type text/html: 可能原因 过滤器或者某个地方对所有 ...
- css不起作用报错:Resource interpreted as Stylesheet but transferred with MIME type text/html
解决:https://blog.csdn.net/sky_cui/article/details/86703706 找了好久........
- Chrome: Resource interpreted as Font but transferred with MIME type font/x-woff
最近,项目中加入了Bootstrap进行界面优化,但是,项目加载运行之后,控制台总是提示以下错误信息: GET http://localhost:8080/.../fonts/fontawesome- ...
- Resource interpreted as Script but transferred with MIME type text/plain:
我用script做ajax跨域,请求返回的是个文本字符串,chrome提示:Resource interpreted as Script but transferred with MIME type ...
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
http://www.2cto.com/os/201312/262437.html 安装了VS2012之后,chrome在加载页面的时候会报 Resource interpreted as Scrip ...
随机推荐
- js获取cookie提取用户名asp.net+html
JavaScript是运行在客户端的脚本,因此一般是不能够设置Session的,因为Session是运行在服务器端的. 而cookie是运行在客户端的,所以可以用JS来设置cookie. 假设有这样一 ...
- sklearn中的多项式回归算法
sklearn中的多项式回归算法 1.多项式回归法多项式回归的思路和线性回归的思路以及优化算法是一致的,它是在线性回归的基础上在原来的数据集维度特征上增加一些另外的多项式特征,使得原始数据集的维度增加 ...
- Excel中列宽、行高与像素的换算公式
DPI Scale ColumnWidth RowHeight 72dpi 75% cw=(pix-5)/6 ...
- maven项目添加配置文件
1. 在src/main/resources下新建param.properties 2. 在param.properties文件中添加 mqtt.host=tcp://127.0.0.1:1883 m ...
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 字体图标(Glyphicons):glyphicon glyphicon-inbox
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...
- restfulframework详解
restfulframework详解 第一篇 RESTful规范
- POJ 3614:Sunscreen 贪心+优先队列
Sunscreen Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5378 Accepted: 1864 Descrip ...
- Codeforces 2A :winner
A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...
- 解决Exception: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z
在项目中添加src中添加NativeIO类 /** * Licensed to the Apache Software Foundation (ASF) under one * or more con ...
- 73.Python中ORM聚合函数详解:Count
Count:用来求某个数据的个数. 在以下所有的示例中所采用的模型为: from django.db import models # 定义作者模型 class Author(models.Model) ...