View Firefox page source in an external editor

Jan 07, '11 07:30:00AM

Contributed by: robg

I use Firefox as my primary browser, and I spend a fair bit of time looking at source code. I've always just opened the source view in Firefox (Command+U), then copied-and-pasted the text to Coda or BBEdit, etc. if I needed to do something with it. While searching for something else today, though, I stumbled on a couple of advanced Firefox settings that let me save the copy-and-paste step -- Command-U now opens the page's source directly in Coda.

To do this, you need to enter about:config in Firefox's URL bar, then accept the warning when prompted. In the Filter box, type source.editor, which will show you three variables. Double-click on view_source.editor.external first, to change its Value to true. Next, double-click on view_source.editor.path, which will drop down a small sheet in which you enter the path to your preferred editor. The path must be a full complete Unix-style path, and point to the actual executable (not the app bundle). So for Coda, I used:

/Applications/added/Coda.app/Contents/MacOS/Coda
For BBEdit, you need to actually point to the command-line version (/usr/local/bin/bbedit)...and to do that, you'll have to have first installed the command line tools within BBEdit itself. Other editors should work; just dig into the bundle (Show Package Contents in Finder's contextual menu) to find the name of the actual binary. Click OK to dismiss the sheet, and you're done.

From now on, Command+U should open the page source in your chosen editor. If it fails, it'll just open directly in Firefox. To revert the behavior, just open about:config again, and set the view_source.editor.external back to false.

[crarko adds: I tested this, and it works as described. One of my favorite features of OmniWeb was the built-in source editor, but this is even more flexible and powerful.]

Comments (8)


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