有没有办法strict MIME type checking在Chrome中禁用.
实际上我正在跨域提出JSONP请求.它在Firefox上运行良好但是,使用chrome时它在控制台中给出了一些错误.
拒绝从' https://example.com ' 执行脚本,因为其MIME类型('text/plain')不可执行,并且启用了严格的MIME类型检查.
它在Mozilla中完美运行.问题仅出现在chrome中
以下是请求的响应标题..
Cache-Control:no-cache, no-store
Connection:Keep-Alive
Content-Length:29303
Content-Type:text/plain;charset=ISO-8859-1
Date: xxxx
Expires:-1
Keep-Alive:timeout=5
max-age:Thu, 01 Jan 1970 00:00:00 GMT
pragma:no-cache
Set-Cookie:xxxx
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options:nosniff
X-Frame-Options:SAMEORIGIN
Run Code Online (Sandbox Code Playgroud)
解决方法我认为:外部设置内容类型为application/javascript
我想学习如何使用rawgit.com来提供其他应用程序github.com.所以我们有一个通常的方法来下载和安装homebrew在osx上.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run Code Online (Sandbox Code Playgroud)
我install在GitHub上找不到该文件.它在哪里?
我将 css 上传到 github,然后转到网站上的文件并单击 raw 选项。我尝试将其添加到网页中,但 chrome 给出以下错误:
资源解释为样式表,但使用 MIME 类型 text/plain 进行传输:“https://raw.githubusercontent.com/me/my-repo/master/style.css”。
和
跨源读取阻止 (CORB) 阻止了 MIME 类型为 text/plain 的跨源响应https://raw.githubusercontent.com/me/my-repo/master/style.css。有关更多详细信息,请参阅https://www.chromestatus.com/feature/5629709824032768 。
我该怎么做才能成功添加此 CSS?我也用 javascript 添加它:
var link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', 'https://raw.githubusercontent.com/me/my-repo/master/style.css');
document.getElementsByTagName('head')[0].appendChild(link);
Run Code Online (Sandbox Code Playgroud) 我无法在网站上显示我的CSS。我真的不知道我在做什么错,我对这一切都是新手,所以我确定有些事情我看不到。
这是实时网站 https://rusne118.github.io/mile-stone-one/4
github ×3
css ×2
git ×2
javascript ×2
angularjs ×1
cloud9 ×1
github-pages ×1
homebrew ×1
jquery ×1