NP_GetMIMEDescription
returns a supported MIME Type list for your plugin. It works on Unix (Linux) and MacOS. On Windows you have to define supported mimetypes in the dll resource file.
Each MIME type description should be separated by a semicolon (;).
Each MIME type description contains the MIME Type, an extensions list and a short description.
One MIME type
// example inside http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/plugin.cpp #define MIME_TYPE_DESCRIPTION "application/basic-plugin:bsp:Basic Example Plug-in for Mozilla" const char* NP_GetMIMEDescription(void) { return(MIME_TYPES_DESCRIPTION); }
Two MIME types
const char* NP_GetMIMEDescription(void) { return "application/basic-example-plugin:xmp1:Example 1;application/basic-example2-plugin:xmp2, xm2p:Example 2"; }
Gnome Integration
If you use GNOME VFS (gnome-vfs-2.0), you can get the MIME type description with a function.
#include <libgnomevfs/gnome-vfs-mime-handlers.h> #include <libgnomevfs/gnome-vfs-mime-info.h> #include <libgnomevfs/gnome-vfs-utils.h> // const char* gnome_vfs_mime_get_description (const char *mime_type); const char* desc = gnome_vfs_mime_get_description ("audio/ogg");
If you use GNOME GIO (gio-2.0), you can get the MIME type description too.
#include <gio/gio.h> const char* desc = g_content_type_get_description("audio/ogg");
JavaScript
Inside a Web page, you can retrieve these informations with this code:
var mimetype = navigator.mimeTypes['application/basic-example-plugin']; if (mimetype) { alert(mimetype.type + ':' + mimetype.suffixes + ':' + mimetype.description); }