2017-11-04 17:23

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


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

Refused to execute script from '' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.



<!doctype html>
<html lang="en-US" prefix="og:" 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="../" />
<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" />
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dongsan6889 dongsan6889 4年前

    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:

    header('Content-Type: application/javascript');
    // rest of the code
    点赞 9 评论 复制链接分享
  • dow58115 dow58115 4年前

    Please go and refer the link

    Hope this might help you.

    Try to do a hard refresh (CMD + SHIFT + R).

    点赞 评论 复制链接分享