Fol*_*ken 5 javascript internet-explorer mime-types
我需要确定从服务返回的某些文件的mime类型,我不知道他们的文件扩展名或他们的类型是什么,基本上我们从API检索文档,如:" http:// site. com/getFile/BFD843DFLKXJDF "最后的随机文本是某个文件.
<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" />
Run Code Online (Sandbox Code Playgroud)
这适用于Firefox,它在警告对话框中返回:pdf文件的"application/pdf".然而,Internet Explorer是我需要定位的主要浏览器,"contentDocument"没有定义(显然我只使用"文档"),但"contentType"也未定义,我不知道IE等价物是什么(谷歌搜索没有产生任何结果).
非常感谢帮助,谢谢.