慕桂英4014372
不跨域或者可以跨域的话function getMime(dist) { return new Promise(function(resolve,reject) { var xhr = new XMLHttpRequest(); xhr.open('GET', dist); xhr.responseType = 'blob'; xhr.onreadystatechange = function() { if(xhr.readyState == 4) { if((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) { resolve(xhr.response.type); }else{ reject(); } } } xhr.send(); }) } getMime().then(function(type){ console.log(type) },function(){ console.log('rejct') });