JavaScript DHTML/HTML/Mime Type
Содержание
Properties of the Mimetype Object
<source lang="html4strict">
/* +-------------------------+--------------------------------------+ Property Description +-------------------------+--------------------------------------+ description Contains the description of Mimetype. +-------------------------+--------------------------------------+ enabledPlugin Contains the plug-in for a specific Mimetype. +-------------------------+--------------------------------------+ suffixes Contains the file extension for Mimetype. +-------------------------+--------------------------------------+ type Contains the string representation of Mimetype. +-------------------------+--------------------------------------+
- /
</source>
Show Browser Mime type (Firefox)
<source lang="html4strict">
<html> <head> <script language="JavaScript">
</script> </head> <body onLoad="showTypes()"> </body> </html>
</source>
Using the mimeTypes Object
<source lang="html4strict">
<HTML> <HEAD> <TITLE>Determining how MIME types are handled</TITLE> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"></SCRIPT> </BODY> </HTML>
</source>
Verifying a MIME Type
<source lang="html4strict">
<HTML> <HEAD> <TITLE>W3C DOM Event Propagation</TITLE> <SCRIPT LANGUAGE="JavaScript"> function mimeIsReady(mime_type) {
if (navigator.mimeTypes[mime_type]) { if (navigator.mimeTypes[mime_type].enabledPlugin) { return true } } return false
} </SCRIPT> </HEAD> <BODY > </BODY> </HTML>
</source>
Verifying Plug-in and MIME Type
<source lang="html4strict">
<HTML> <HEAD> <TITLE>W3C DOM Event Propagation</TITLE> <SCRIPT LANGUAGE="JavaScript"> function mimeAndPluginReady(mime_type, plug_in) {
if (mimeIsReady(mime_type)) { var plugInOfRecord = navigator.mimeTypes[mime_type].enabledPlugin plug_in = plug_in.toLowerCase() for (var i = 0; i < navigator.plugins.length; i++) { if (navigator.plugins[i].name.toLowerCase().indexOf(plug_in) != -1) { if (navigator.plugins[i] == plugInOfRecord) { return true; } } } } return false;
} </SCRIPT> </HEAD> <body> </BODY> </HTML>
</source>