dongwei3712 2017-11-04 17:23 采纳率: 100%
浏览 1318
已采纳

拒绝从'file_name.php'执行脚本,因为它的MIME类型('text / html')不可执行,并且启用了严格的MIME类型检查

我创建了一个网站。 它在我的本地服务器上正常工作,但是当我把它上传到实时服务器时,它会给我这个错误:

Refused to execute script from 'http://www.mahijat.tk/new/wp-content/cache/autoptimize/autoptimize_c648c3203309d095775637e672c00239.php' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

我的网站地址:http://www.mahijat.tk/new/

我的index.php文件代码是:

<!doctype html>
<html lang="en-US" prefix="og: http://ogp.me/ns#" class="no-js ">

<head><meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:image" content="../pbs.twimg.com/profile_images/601407094277873664/WT2mk28E_400x400.jpg" />
<link type="text/css" media="all" href="wp-content/cache/autoptimize/autoptimize_ac4e9617d860b901a683f7676a3c44be.css" rel="stylesheet" />
<link type="text/css" media="all" href="wp-content/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
  • 写回答

2条回答 默认 最新

  • dongsan6889 2017-11-04 17:42
    关注

    This is usually a Chrome error that happens when you make an AJAX jsonp request to a page that returns javascript but incorrectly sends a Content-Type: text/html header.

    You can fix it by changing your autoptimize_.....php file to send the proper Content-Type header before outputting the javascript:

    <?php
    header('Content-Type: application/javascript');
    // rest of the code
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题