Bhargav Patel
Bhargav Patel

Reputation: 29

Internet Explorer mimeTypes always empty and there is no way to get the supported MIME types in this the browser

Following line of code not working on IE

<head>
    <script type="text/javascript">
        function GetMimeTypes () {
            var message = "";
                // Internet Explorer supports the mimeTypes collection, but it is always empty
            if (navigator.mimeTypes && navigator.mimeTypes.length > 0) {
                var mimes = navigator.mimeTypes;
                for (var i=0; i < mimes.length; i++) {
                    message += "<b>" + mimes[i].type + "</b> : " + mimes[i].description + "<br />";
                }
            }
            else {
                message = "Your browser does not support this example!";
            }

            var info = document.getElementById ("info");
            info.innerHTML = message;
        }
    </script>
</head>
<body onload="GetMimeTypes ()">
    Supported MIME types:
    <div id="info" style="width:500px; height:300px; overflow:auto; background-color:#e0d0d0;"></div>
</body>

For more Detail visit

http://help.dottoro.com/ljfhqmfq.php

Upvotes: 2

Views: 649

Answers (1)

securecodeninja
securecodeninja

Reputation: 2515

Which version of IE were you using?

I tried the same code in IE11 and it works perfectly fine. I got the below results:

Supported MIME types: application/x-director : Shockwave application/x-shockwave-flash : Shockwave Flash application/futuresplash : Shockwave Flash application/x-silverlight-2 : Silverlight Plug-In application/x-silverlight : Silverlight Plug-In

As per MSDN library, "Starting with IE11, the navigator object supports plugins and mimeTypes properties."

http://msdn.microsoft.com/en-us/library/ie/dn423948%28v=vs.85%29.aspx

Upvotes: 2

Related Questions