View Full Version : mimeTypes

Jul 25th, 2002, 12:04 PM
Hi, It seems that it's something wrong with the mimeTypes, when I write:


it gives me zero! I have almost everything in my browser, I can see the flash files, movies, sounds and almost everything! why doesn't it work?

something else, let's say that I wana see if my clients have the flash player installed on their browsers, and based on that I show some stuff, the following should work:

// Can we display Shockwave movies?
mimetype = navigator.mimeTypes["application/x-director"]
if (mimetype) {
// Yes, so can we display with a plug-in?
plugin = mimetype.enabledPlugin
if (plugin)
// Yes, so show the data in-line
document.writeln("Here\'s a movie: <EMBED SRC=mymovie.dir HEIGHT=100 WIDTH=100>")
// No, so provide a link to the data
document.writeln("<A HREF='mymovie.dir'>Click here</A> to see a movie.")
} else {
// No, so tell them so
document.writeln("Sorry, can't show you this cool movie.")

but as I said, it shows my mimeTypes.length as zero! is it normal? I tried that on another comp too, but it's the same!

Jul 25th, 2002, 07:32 PM
Only Netscape browsers providing a meaningful mimeTypes array - it is always empty in IE and is essentially useless.

Jul 27th, 2002, 01:06 PM
Someone else gave me this snippet ( he/she was a moderator too!), it's perfectly working, at least it shows "myFlash.swf", I dunno if it could find out if I don't have flash installed on my comp and it could show "myImage.gif" too!
Here's the program:

<script type="text/javascript">
plgIn = "Shockwave Flash";
ok = false;
document.returnValue = false;

with (navigator)
if (document.all && appVersion.indexOf('Mac')==-1)
document.write('<scrip'+'t language="VBScript">\nOn error resume next\n' + 'dir = (IsObject(CreateObject("SWCtl.SWCtl.1")) Or IsObject(CreateObject("Macromedia.ActiveShockwave.1")))\n' + 'flash = NOT IsNull(CreateObject("ShockwaveFlash.ShockwaveFlash"))\n<\/scrip'+'t>');

if (!document.all)
ok = (plugins && plugins[plgIn]);
if (appVersion.indexOf('3.1') == -1)
if (plgIn.indexOf("Flash")!=-1 && window.flash != null)
ok = window.flash;
else if (plgIn.indexOf("Director")!=-1 && window.dir != null)
ok = window.dir;
ok = autoGo;

if (ok)
document.write('<embed src="myFlash.swf" type="application/x-shockwave-flash" loop="false" menu="false" quality="autohigh" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
document.write('<img src="myImage.gif" type="image/gif" alt="My Image">');