javascript - XMLHttpRequest.getResponseHeader() returns null -
i've created custom mime type called application/x-mytype
extension .mytype
following this link. then, created file in server named test.mytype
, i'm trying it's content-type via xmlhttprequest
looks browser cannot detect it.
var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else { xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.open("get", "https://{myserver}/test.mytype", true); xmlhttp.send(null); xmlhttp.onreadystatechange = function (oevent) { if(xmlhttp.readystate==4) { var contenttype = xmlhttp.getresponseheader('content-type'); console.log(contenttype); // prints null if(contenttype === 'application/x-mytype') { // never arrives here } } };
if @ "file type" via windows explorer, can see custom type, looking @ windows registries. have set else or browsers aren't supposed identify custom mime type?
Comments
Post a Comment