I want to determine the mimetype of a webpage.
I am specifically looking for a statement like this, which works for Firefox:
if (document.contentType == 'text/html') {
performX();
} else {
performY();
}
However, a statement which works across all browsers is preferred. Some google result suggested me this, but it fails:
if (document.getElementsByTagName("head").length + document.getElementsByTagName("frameset").length != 0) {
performX();
} else {
performY();
}