$.ajax({
type: 'POST',
url: "http://www.youtube.com",
dataType: 'jsonp',
beforeSend: function( xhr ) {
contentType: "text/html; charset=utf-8",
xhr.setRequestHeader( "Content-Type", "text/html" ),
xhr.overrideMimeType( "text/html" )
},
success: function (data) {
$( "#post-result" ).text(data);
}
});
此代码运行到控制台错误:拒绝执行来自' http://www.youtube.com/?callback=jQuery110106930327706504613_1447535859452&_=1447535859453'因为它的MIME类型(' text / html')不可执行,并且启用了严格的MIME类型检查。