Created
December 6, 2013 14:47
-
-
Save AshKyd/7825918 to your computer and use it in GitHub Desktop.
Get the content type for a certain URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getContentType(url,callback){ | |
var oReq = new XMLHttpRequest(); | |
oReq.onreadystatechange = function(){ | |
if(this.readyState == this.DONE){ | |
callback(this.getResponseHeader("content-type")); | |
} | |
}; | |
oReq.open("head", url, true); | |
oReq.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment