HTML and CSS Reference
In-Depth Information
(see Table 10.3). These objects are predefined JavaScript objects that allow you to access
the mimeTypes[] array, a property of both the navigator object and the plugin object.
(Note: The mimeTypes[] array will not produce output in IE.) audio/x-pn-realaudio-plug-
in is an example of a MIME type for RealPlayer G2 LiveConnect-Enabled Plug-In.
Table 10.3 Properties of the mimeType Object
Property
What It Describes
description
A description of the MIME type.
enabledPlugin
A reference to the plugin object for this MIME type .
suffixes
A string of file name extensions allowed for this MIME type;
e.g., jpeg, jpg, jpe, jfif, pjpeg, pjp object;
e.g., navigator.plugins["Shockwave"].length.
type
The name of the MIME type; e.g., image/jpeg.
EXAMPLE 10.6
<html>
<head><title>Mime Detection</title></head>
<body bgcolor="lightgreen">
<h3><u>Mime Types--Firefox</u></h3>
<b>
<script type="text/javascript">
for ( var i=0;i < navigator.mimeTypes.length ; i++){
1
if( navigator.mimeTypes[i].enabledPlugin != null ){
document.write ("<br /><font size='+1'>"+
2
navigator.mimeTypes[i].type +"<br />");
document.write("<font size='-1'>"+
"Enabled Plugin Name: <em>"+
document.write("<font size='-1'>"+
3
navigator.mimeTypes[i].enabledPlugin.name +"<br />");
document.write("</em>Description: "+ "<em>"+
4
navigator.mimeTypes[i].description +
"<br /></em>Suffixes: "+ "</em>"+
5
navigator.mimeTypes[i].suffixes +"<br />");
}
}
</script>
</body>
</html>
 
Search WWH ::




Custom Search