【发布时间】:2016-08-23 20:46:02
【问题描述】:
当我尝试在 google chrome 上使用我的 LESS 文件时,它会在控制台上显示此错误:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
less.js:446 XMLHttpRequest cannot load file:///path/core.less. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
我已经下载了less.js,并将其放入如下所示的脚本标签中
head class="Setup">
<!-- LESS -->
<link rel="stylesheet/less" type="text/css" href="path/core.less"/>
<script src="path/less.js" type="text/javascript"></script>
但是,如果我为我的文本编辑器使用一个包,即https://atom.io/packages/browser-plus,它可以正常工作。控制台日志:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
less.js:837 rendered file:///path/core.less successfully.
less.js:837 css for file:///path/core.less generated in 67ms
less.js:837 less has finished. css generated in 67ms
检查 Google Chrome 版本后,文本编辑器使用版本 47,而我的普通 chrome 使用版本 50。我不知道发生了什么。有解决办法吗?
编辑:找到less.js not working in chrome 由于我不知道如何设置 Apache,我尝试搜索如何创建命令行开关,而我使用的是 mac,结果显示了 windows 结果。
【问题讨论】:
标签: css google-chrome less