Add browsers to the Internet prefs panel

Oct 12, '01 07:42:32AM

Contributed by: robg

A while back, I published an article titled Retaining OmniWeb as the default browser. This hack has changed a bit with the release of 10.1, and I thought I'd add information on how to make other browsers appear in the "Web" pop-up portion of the Internet preferences panel, and to set any one of them as the default.

The article might also be of interest if your "Web" setting seems to have amnesia - you change it, but then it randomly changes back to IE. I'll explain how to eliminate all choices except for your favorite, which (at least for me so far!) seems to prevent the "IE amnesia" from recurring.

So if you'd like to see more browser choices in your Web pop-up, or just prevent the Web pane from forgetting your preferred choice, read the rest of this article.

NOTE:This modification requires editing of a system file. This can be dangerous if you mess something up. Please make sure you follow the directions as written, and you are responsible for what may or may not happen to your system as a result of this modification.

The following steps will edit the file that builds the content of the "Web" panel of the Internet system preferences pane. Before we edit, we'll make a backup of the file, in case anything goes wrong. Some terminal use is required, but not too much!

  1. Launch the Terminal and type the following:
    cd /System/Library/PreferencePanes
    cd Internet.prefPane/Contents/Resources/English.lproj
    NOTE: This is shown as two separate commands to narrow the article's width; you could enter it on one long line (add a slash between PreferencePanes and Internet.prefPane). This changes us to the directory containing the file we wish to modify.

  2. Now we'll back up the file before we start to modify it. In the terminal, type:
    sudo cp DefaultHelperApps.plist DefaultHelperApps.bak
    You'll be prompted for your normal user password; we need to use 'sudo' to execute the backup command as the root user, since root owns the file.

  3. Time to edit the file! We'll use 'pico', but experienced UNIX users could use vi or emacs instead. To open the file with pico, type
    sudo pico DefaultHelperApps.plist
    This should open pico as root (you'll need to supply your admin password) with the DefaultHelperApps file open. Pico is relatively self-explanatory; just look at the menus at the bottom of the screen for help.

  4. To add browsers to the list, replace this section of code
    web = (
    {
    DisplayName = "Internet Explorer";
    Info = { BundleIdentifier = "com.microsoft.explorer"; };
    IsDefaultHandler = YES;
    }
    );
    with this section of code:
    web = (
    {
    DisplayName = "Internet Explorer";
    Info = { BundleIdentifier = "com.microsoft.explorer"; };
    },
    {
    DisplayName = "OmniWeb";
    Info = { BundleIdentifier = "com.omnigroup.OmniWeb"; };
    IsDefaultHandler = YES;
    },
    {
    DisplayName = "Mozilla";
    Info = { BundleIdentifier = "com.mozilla.mozilla"; };
    },
    {
    DisplayName = "iCab";
    Info = { CreatorCode = "iCab"; };
    }
    );
    Notice that only one browser can be tagged with the "IsDefaultHandler" tag; simply put that entire line with the section related to the browser of your choice.

  5. Although the above will give you more browser choices, it may not prevent the Internet prefs from forgetting your favorite and reverting to IE. I chose to eliminate all browsers except my favorite to prevent this problem. To do that, simply insert ONLY the relevant section from above for the browser of your choice, and include the IsDefaultHandler tag. Also note that you will NOT need a comma after the closing "}". With only one option available, I haven't had my preference revert to IE since I did this modification.

  6. When you're done, save your changes (control-O) then quit pico (control-X) and reopen the System Prefs application. You should now see your choices in the Web pop-up menu in the Internet prefs pane.

  7. If, for some reason, this doesn't appear to have worked, revert to your backup from the Terminal by doing the following (assuming you're still in the directory from step one; if not, repeat step one!):
    sudo rm DefaultHelperApps.plist
    sudo mv DefaultHelperApps.bak DefaultHelperApps.plist
    This will replace the bad file with the good backup, and you can try again -- remember to create another backup on your second try!
If you wish to add other browsers, the format is the same, the only complication is finding the BundleIdentifier for Cocoa and Carbon apps. For Cocoa apps, control-click on the application, pick "Show Package Contents", open the Contents folder, then open Info.plist in an editor and look for "BundleIdentifier".

Carbon apps are a bit trickier, and I'm not sure what the "right" way to do it might be. With Mozilla, for example, I just looked in my ~/Library/Preferences folder and saw "com.mozilla.mozilla.plist" so I tried it and it worked (don't include the ".plist" extension in the BundleIdentifier line!). Other Carbon apps, such as iCab, didn't seem to have an identifiable "com" file in my prefs folder; Jan S. emailed me the answer with the CreatorCode syntax shown above -- just get the app's creator code through traditional means and use it as shown.

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=200110120742326