<embed type="your-type/your-subtype" ...other parameters .../>Using a text config file, you can map mime types to applications you want to run. The plugin will simply look up the mime type in a config file, and run the corresponding program in the browser object.
Note, we realised recently that there is a similar tool called mozplugger. Please have a look at it too.
To use this plugin, you must copy into ~/.mozilla/plugins both app-wrapper.so and a suitably edited copy of a configuration file, app-wrapper.conf, containing one line for each mime type you want to support:
See app-wrapper.conf for more details.# ~/.mozilla/plugins/app-wrapper.conf: video/x-flv:flv:mplayer for flash video:stream:safe:mplayer -wid %w - # run xterm in a window, only on local pages (file://...) application/x-xterm:xterm:xterm in a window:xterm -into %w # same as above, but enable it for external pages too application/x-xterm-safe::xterm in a window:safe:xterm -into %w
Please be aware of the security risk of enabling applications in this plugin. Do not mark a program as 'safe:' unless you know what you are doing.
The graphic output of the program is shown in a browser's window, so we need a way to tell the application the window id.
For SDL applications, it suffices to set the environment variable SDL_WINDOWID (which is something the wrapper does). There are some limitations in the way SDL handles SDL_WINDOWID, in particular mouse and keyboard events, and resize are not handled in external windows, so the program might need some tweaks until SDL applies proper fixes.
For generic X11 apps, there is no standard way - some programs do have command-line options to specify this, and we note this below. The '%ld' in the 'cmd' string is replaced with the window id.
NOTE: Mozilla caches the information returned by plugins, so whenever you change the configuration file you should also 'touch' the app-wrapper.so binary, and possibly restart the browser.
This program is joint work by Luigi Rizzo, Riccardo Panicucci and Marta Carbone. Some of the sources come from the Mozilla devkit and carry the original content and copyright. New files are under a BSD copyright.