demo.php:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script src="js.php" type="text/javascript"></script>
</body>
</html>js.php:
<?php
header('X-Content-Type-Options: nosniff');
//header('Content-type: text/javascript');
?>
alert("木子屋: http://www.mzwu.com/");在Firefox打开demo.php,控制台提示错误如下:
来自“http://www.moju365.com/js.php”的资源已被阻止,因为 MIME 类型(“text/html”)不匹配(X-Content-Type-Options: nosniff)。



去掉header('Content-type: text/javascript')前的注释,页面即可正常显示。
评论(0)
暂无评论。