From our LiveHTTPHeaders Firefox download example, you can see that the MIME type or Content-Type in the header information is as follows: Content-Type: application/x-msdos-program Now y
Trang 1From our LiveHTTPHeaders Firefox download example, you can see that the MIME type or Content-Type in the header information is as follows:
Content-Type: application/x-msdos-program
Now you take this value and add it to the internal list of MIME types with the following steps:
1 Open Tools ➪ Mimetype.
2 Click on the New Type button (shown in Figure 11-15), which opens the Edit Type
window, shown in Figure 11-16
3 Populate the MIME Type field with the Content-Type value of application/ x-msdos-program
4 Type a general description, such as Program Files or Application.
5 Enter exe in the Extension field, which corresponds to the filename extension.
6 Choose a default action for this type and then enable or disable the “Always ask me
before handling files of this type” setting according to your preference
F IGURE 11-16: Mimetype Editor’s Edit Type screen
This MIME type update is applied immediately and can be tested by redownloading the file in question If the Opening dialog (shown in Figure 11-13) still pops up, make sure you have supplied the correct MIME Type without leading or trailing spaces and that you are using the correct filename extension
Trang 2Installing via the Install link on the Mimetype Editor web page may not work; just choose the Download link, and it will prompt you to install
Another key observation is that managing and using MIME types is internal to Firefox and not a function of the extension This extension merely helps you manage the internal list that Firefox uses, which means that once you are content with changes to the different MIME types you need, you can disable or uninstall it without sacrificing the customizations that you have made to the MIME type list
Custom MIME type definitions are stored with each profile in the mimeTypes.rdf file, which
is formatted in standard RDF/XML syntax While you can manually edit this file, I find it eas-ier to use these extensions to modify MIME behavior Another nice feature of this file is that it makes it easy to duplicate the customizations to another computer or profile by just copying it
to the main profile directory of the profile that needs updating
For more information on the Mimetype Editor extension, visit http://gratisdei.com/FF htm#mtypes
Hacking External Download Managers
Most new Firefox converts have an existing arsenal of tools and utilities installed that help with anything from printing to downloading Some tools that are used for managing downloads are GetRight, Mass Downloader, Download Express, and so on While newer versions of these tools are smarter in detecting the presence of the Firefox installation, some have yet to update
This section covers two approaches to hooking Firefox to your external Download Manager by using either the Launchy or FlashGot extensions or by hunting down the needed files for full integration
What Is MIME Type Spoofing?
MIME type spoofing is commonly used by different software update sites to force a download, open, or save prompt The technique they use is to create a custom header with the addition of
a custom MIME type Because the browser does not recognize the MIME type, it will bring up the Opening prompt and ask you how to handle the download One possible spoof could look like this:
application/download-this
You would have to add this custom type and associate the default actions that you prefer Using LiveHTTPHeaders, you are able to easily detect any MIME type spoofing practices by capturing the header information while the file is downloading
Trang 3Using Launchy to Handle External Programs
One of the beautiful things about Launchy is its ability to detect and show installed applications via the right-click menu This, coupled with the ease of integrating them with Firefox, makes it the easiest approach to merging installed program handling with Firefox Launchy supports over
60 external applications and currently supports the following external download managers:
GetRight
LeechGet
Mass Downloader
Star Downloader
Internet Download Manager
ReGet Deluxe
BitTorrent
FlashGot
WackGet
Offline Explorer Pro Additionally, Launchy supports many common external browsers, media players, FTP clients, and editors
Figure 11-17 illustrates the automatic detection of the currently installed programs that it sup-ports and the two download managers currently available on my system Advanced configura-tion opconfigura-tions are available, but right out of the box, this extension does a lot To activate or use its features, just right-click on a link and select the desired external program from the Launchy submenu To disable showing a detected application from the list, just uncheck it in the Launchy Options window
F IGURE 11-17: Launchy Options window
Trang 4For more information or to download Launchy, visit http://gemal.dk/mozilla/
launchy.html
Using FlashGot to Handle External Programs
Another wildly popular extension used to handle external download programs is FlashGot
Much like the Launchy extension, FlashGot provides support and automatic detection of external download managers, but also merges in the functionality of extensions such as Linky and DownThemAll by allowing you to download all links from the page being viewed via the right-click menu Another great feature that FlashGot provides, as shown in Figure 11-18, is that it adds an option to the standard Opening Firefox Setup dialog, which helps with MIME types that Firefox does not know how to handle Using FlashGot, you can avoid the lengthy setup and detailed drudgeries involved with manually having to find and set up the default method to handle unknown MIME types
F IGURE 11-18: The Opening Firefox Setup dialog with FlashGot feature
For more information or to download FlashGot, visit http://www.flashgot.net/
Seamless Download Integration
So what if you want seamless download integration with Firefox — integration that does not require intervention on your part? Then you have to dig a little deeper or check for a few set-tings Newer versions of popular programs such as Download Express, Mass Downloader, and GetRight have added Firefox detection or provide a mechanism for seamless integration
MetaProducts has gone one step further and has created an official extension for Mass Downloader and Download Express to allow Firefox integration
Trang 5So what exactly are these programs doing to integrate themselves in the world of Firefox? Quite simply, just copying a plugin file to the Firefox Plugins directory While I will cover plug-ins more in the next section, this introduction is a nice segue to help with downloads first Most download programs have code that comes bundled to help Firefox and other browsers
with settings and options This code, called a plugin, operates quite differently from extensions,
and for the most part, these plugins are operating system–dependent Again, while most updated version of these programs have this feature integrated into their options or settings, you can manually find the needed plugin DLL file(s) by doing a little digging Once you have identified the program you want to dig into, all you have to do is find its default installation directory and hunt around for the corresponding DLL file One key thing to note is that in the file’s properties, the description provided may assist you in finding the correct plugin DLL If you are not sure, hold on the side of caution and do not copy any of the files to the plugins directory
To manually install a plugin file, close Firefox, copy the DLL file to the plugins subdirectory of your Firefox installation, and restart Firefox
Plugins are also the technology implemented by Flash and Macromedia to extend Firefox’s capabilities
Table 11-2 lists the directory and plugin files for GetRight and Mass Downloader
Table 11-2 GetRight and Mass Downloader
GetRight Mass Downloader
Default directory C:\Program Files/GetRight C:\Program Files\Mass Downloader
You can find more information on external Download Manager integration for Windows by vis-iting http://plugindoc.mozdev.org/windows4.html
Hacking Plugins
Plugins are compiled pieces of code that implement a standard connection or interface using
the plugin architecture, which was originally used as far back as early Netscape versions Using this interface, third-party developers have the capability of extending and enhancing the fea-tures of the browser to handle audio, video, custom filetypes, or processing of requests
Trang 6While the previous section briefly covered how to find the plugins file for a couple of the com-mon download programs, this section helps you test your plugins configuration, find additional plugins that you may already have installed, and disable the default behavior from some of the currently installed plugins Figure 11-19 is a sample plugins directory that contains support for Apple QuickTime, RealPlayer, and Macromedia Flash
F IGURE 11-19: Sample plugins directory
The ultimate plugins reference for users is located at http://plugindoc.mozdev.org/
Checking Installed Plugins with about:plugins
Firefox and its predecessors include a simple page that helps you see which plugins are
cur-rently installed and recognized To access this page, just type about:plugins in the location bar
and press Enter
Figure 11-20 shows a sample page populated with all of the plugins that Firefox was able to automatically detect, based on operating system and configuration, in addition to the specific plugins located in the plugins subdirectory of your Firefox installation
Because the Opera browser uses the same plugins programming interface, most, if not all, of the Opera plugins are compatible with Firefox
Trang 7F IGURE 11-20: about:plugins displayed information
For testing purposes, you can also display the full installation path for each of the programs listed in the about:Plugins page by modifying the following preference and setting it to true:
user_pref(“plugin.expose_full_path”, true)
Please keep in mind that showing the plugin’s full path may open you to potential security risks, because most of these values are exposed to public web pages to help them detect if you have proper support for key features such as Flash and others Use this option only for testing purposes, and make sure to reset this value to falseonce you are done
Using Available Plugins without Reinstalling
Because several programs already have support for Mozilla or Firefox’s plugins technology, reinstalling these programs would seem a tad redundant This section shows you how to manu-ally dig around Adobe Reader, Apple QuickTime, and RealPlayer plugins When copying plugins to the Firefox\Plugins directory, it is generally safe to assume that you can replace existing files
When manually copying files, make sure Firefox is closed
Trang 8Finding the Adobe Reader Plugin
To see if your Adobe Reader installation supports the browser plugin, check the following directory, substituting for the question mark the version you have installed:
C:\Program Files\Adobe\Acrobat ?.0\Reader\Browser
Then copy the Plugin file listed to your Firefox\Plugins directory:
nppdf32.dll
Finding the Apple QuickTime Plugin
The required plugin files for QuickTime are located in the plugins directory (C:\Program Files\Apple\QuickTime\Plugins) of your QuickTime installation Just copy all the files in that directory, which are gathered in the following list, to the plugins subdirectory:
npqtplugin.dll
npqtplugin2.dll
npqtplugin3.dll (file may not exist)
npqtplugin4.dll (file may not exist)
npqtplugin5.dll (file may not exist)
QuickTimePlugin.class Then copy the following component files in the QuickTime plugins directory to the compo-nents subdirectory of your Firefox installation:
nsIQTScriptablePlugin.xpt
Finding the RealPlayer Plugin
RealPlayer may have two different directories that you need to tap into:
C:\Program Files\Real\RealPlayer\Netscape6 can be the default location for both plug-ins and components
It can have a Plugins directory of C:\Program Files\Real\RealPlayer\Browser\Plugins and a Components directory of C:\Program
Files\Real\RealPlayer\Browser\Components
In either case, copy the following files to the corresponding Plugins subdirectory in Firefox:
nppl3260.dll
nprjplug.dll
Trang 9Then copy the following components files to the components subdirectory of your Firefox installation:
nppl3260.xpt
nsJSRealPlayerPlugin.xpt
Because of security concerns and potential issues, Windows Media Player embedding with ActiveX should not be tampered with unless you have fully read the implications For more information, visit the “Embedded Windows Media in Firefox” posting available at http:// forums.mozillazine.org/viewtopic.php?t=206213
A good reference for installing or configuring plugin support in Firefox for some common pro-grams is available at http://www.mozilla.org/support/firefox/faq#plugins
Disabling Plugin Support for Specific File Extensions
Because Firefox is designed to detect some common plugins, you may want to disable internal plugin handling of common file extensions Firefox has a configuration screen in the
Downloads section of the Tools ➪ Options window In Figure 11-21, you can see that just by unchecking the Enabled column of the file extension, you can customize internal extension handling When you are done, click OK, and you are all set
F IGURE 11-21: The Plug-Ins support options window
Trang 10While this chapter covers a lot of the basic customizations that you can apply to Firefox to handle downloading, MIME types, and plugins, even more options are available At this point, you should be able to change the visual and the internal functionality of each of these func-tions, in addition to knowing where Firefox stores the related keys files
Extensions such as Download Statusbar, Disable Targets for Download, Mimetype Editor, and Live HTTP Headers have become daily staples for me; you may find other extensions, such as Download Sort and Download Manager Tweak, suit your needs better Any combination of these extensions that are actively updated and supported should yield a great download and plugin experience when using Firefox