简体   繁体   中英

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

I make a site. It's working properly on my local server but when I upload it to live server it is giving me this error:

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.

My site URL is http://www.mahijat.tk/new/

My index.php file code is

<!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" />

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

Please go and refer the link

Hope this might help you.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question GeoJSON file: Refused to execute script from because its MIME type ('') is not executable, and strict MIME type checking is enabled Refused to execute script from 'URL' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled Angular 6 : Refused to execute script from 'URL' because its MIME type( ) is not executable, & strict MIME type checking is enabled Refused to execute script because MIME type ('text/html') is not executable, and strict MIME type checking is enabled strict mime type checking is enabled, refused to execute script from '<url>' its mime type ('text/plain') is not executable, and Refused to execute script because its MIME type ('application/gzip') is not executable, and strict MIME type checking is enabled Refused to apply style from '<URL>' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled getting Refused to execute script from '*' because its MIME type ('application/json') is not executable, and strict MIME type che Refused to apply style from... because its MIME type ('text/html') is not a supported style-sheet MIME type, and strict MIME checking is enabled Refused to execute script from 'http://127.0.0.1:5500/' because its MIME type ('text/html') is not executable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM