Bootstrap为什么尝试在Edge中加载LESS文件? [英] Why is Bootstrap trying to load LESS files in Edge?

查看:152
本文介绍了Bootstrap为什么尝试在Edge中加载LESS文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Twitter Bootstrap的网页.它在Chrome,Firefox和Safari中运行良好.但是,当我尝试在Windows 10的Edge中查看它时,出现一堆403错误,提示它无法从Bootstrap CDN加载大量的.less文件.如果浏览器无法执行.less文件,为什么会请求它们?我根本不使用LESS,仅使用纯CSS3,就可以了.我该如何停止?

I have a web page using Twitter Bootstrap. It works well in Chrome, Firefox, and Safari. However, when I try to view it in Edge on Windows 10, I get a bunch of 403 errors saying it failed to load a slew of .less files from the Bootstrap CDN. Why are .less files being requested if the browser can't do anything with them? I am not using LESS at all, just plain CSS3, which is rendering just fine. How do I make this stop?

推荐答案

好消息是,这不会影响网站的常规用户.坏消息是,Chrome也在某种程度上发生了这种情况,只是Chrome中的网络"标签未报告403错误.

The good news is this won't be affecting regular users of the site. The bad news is this is also happening in Chrome to some extent, it's just that the network tab in Chrome isn't reporting the 403 errors.

在链接到的CSS文件中,文件底部有一行:

In the CSS file that you link to there is a line at the bottom of the file:

/*# sourceMappingURL=bootstrap.min.css.map */

这是源映射,并提供指向用于生成浏览器中的最小CSS的所有源文件的链接.

This is the source maps and gives links to all the source files used to generate the minified CSS that is in your browser.

在引导程序实例中,CDN指向不存在的文件,例如 http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/less/scaffolding.less

In the bootstrap instance the CDN is pointing to files that do not exist such as http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/less/scaffolding.less

仅当您启用了源地图并且打开了开发工具时,才会下载源地图文件. Edge默认启用了源映射,据我所知没有办法将其关闭(但请记住,只有在打开开发工具时才会发生这种情况,我已经使用Fiddler确认了这种行为),因此当您按f12键时,将尝试获取源映射文件. Chrome的工作方式略有不同,它将下载源地图,但在导航到源文件之前,不会尝试下载.less文件.

The source map file will only be downloaded if you have source maps enabled and your dev tools open. Edge defaults source maps on and as far as I can tell there is no way to switch them off (but remember this will only happen when the dev tools are open, I have confirmed this behaviour using Fiddler), so when you press f12 then it's going to try and fetch the source mapped files. Chrome works slightly differently, it will download the source map but then will not attempt to download the .less file until you navigate to the source file.

如果.less文件之一返回403禁止响应,则Edge将在网络"选项卡中报告此情况. Chrome没有.

If one of the .less files is returning a 403 Forbidden response Edge reports this in the network tab. Chrome dosen't.

如果使用诸如Fiddler之类的http调试器,您会看到Chrome确实确实在请求文件,并且还会收到403响应,但是,它不会在网络"标签上报告该错误.当使用Fiddler克服https问题时,我将CSS文件更改为指向非https URL.例如: http://maxcdn.bootstrapcdn.com/bootstrap/3.3 .6/css/bootstrap.min.css

If you use http debugger such as Fiddler you will see that Chrome does indeed request the files and also gets a 403 response, however, it doesn't report it on the network tab. When using Fiddler to get past the https issue I changed the CSS file to point to the non https URL. e.g: http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css

此问题的解决方法是修复源映射中403'的文件.我在bootstrap maxcdn GitHub repro上提出了一个问题: https://github.com/MaxCDN /bootstrap-cdn/issues/629

The fix for this issue is to fix the files that are 403'ing in the source map. I have raised an issue on the bootstrap maxcdn GitHub repro: https://github.com/MaxCDN/bootstrap-cdn/issues/629

这篇关于Bootstrap为什么尝试在Edge中加载LESS文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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