You could use getResponseHeader of XMLHttpRequest to check the mime type of the successfully returned content of your request. In fact you can't know the content of the response only based upon the http success response code of your request.
The XMLHttpRequest method getResponseHeader() returns the string
containing the text of a particular header's value. If there are
multiple response headers with the same name, then their values are
returned as a single concatenated string, where each value is
separated from the previous one by a pair of comma and space. The
getResponseHeader() method returns the value as a UTF byte sequence.
In this example, a request is created and sent, and a readystatechange
handler is established to look for the readyState to indicate that the
headers have been received; when that is the case, the value of the
Content-Type header is fetched. If the Content-Type isn't the desired
value, the XMLHttpRequest is canceled by calling abort().
var client = new XMLHttpRequest();
client.open("GET", "unicorns-are-teh-awesome.txt", true);
client.send();
client.onreadystatechange = function() {
if(this.readyState == this.HEADERS_RECEIVED) {
var contentType = client.getResponseHeader("Content-Type");
if (contentType != my_expected_type) {
client.abort();
}
}
}
All the best.