“refused to execute script from *.php”解决方法-奇怪的新问题

某WEB程序中需要用php 动态产生javascript,但是有一天使用CDN之后,这个就不能用了,谷歌浏览器爆出了一些错误,如下:
refused to execute script from ‘http://*/common.php’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.
忽然想到,这个文件没有header标记,随写添加一句:

header("Content-type:application/javascript;charset=utf8");

然后就OK!
类似于Header信息举例,希望对大家有帮助。(不详细注释)

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); 
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); 
header("Cache-Control: no-cache, must-revalidate" ); 
header("Pragma: no-cache" );
header("Content-Type: text/xml; charset=utf-8");