I need to determine the mime type of certain files that are returned from the service, I do not know their file extensions or what their type is at hand, basically we extract documents from the API, for example: " http://site.com/getFile/ BFD843DFLKXJDF ", where the random text at the end is some file.
<input type="button" value="Click Me" onClick="alert(document.getElementById('iframeID').contentDocument.contentType);">
<iframe id="iframeID" src="http://site.com/getFile/BFD843DFLKXJDF" width="600" height="600" />
This works in Firefox, it returns in the alert dialog: "application / pdf" for PDF files. However, Internet Explorer is the main browser that I need to configure, the “contentDocument” is not defined (apparently I use only the “document” instead), but the “contentType” is also undefined, and I don’t know what the IE equivalent is (Google searches yielded no results).
Help is much appreciated, thanks.
source
share