Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

View Firefox page source in an external editor Web Browsers
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.]
    •    
  • Currently 4.00 / 5
  You rated: 1 / 5 (7 votes cast)
 
[10,819 views]  

View Firefox page source in an external editor | 8 comments | Create New Account
Click here to return to the 'View Firefox page source in an external editor' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View Firefox page source in an external editor
Authored by: bloodnok on Jan 07, '11 01:50:58PM

interestingly enough, you can't launch dreamweaver this way. although /Applications/Adobe\ Dreamweaver\ CS5/Adobe\ Dreamweaver\ CS5.app/Contents/MacOS/Dreamweaver works from the command line, it fails from firefox. textwrangler, being better behaved, works though.



[ Reply to This | # ]
View Firefox page source in an external editor
Authored by: asmeurer on Jan 07, '11 05:27:59PM
For TextWrangler, you should use the edit command (you may have to select "Install Command Line Tools…" from the TextWrangler menu first).

[ Reply to This | # ]
View Firefox page source in an external editor
Authored by: ddauerbach on Jan 07, '11 02:01:03PM

I couldn't get it to work with Coda.
/Applications/Coda.app/Contents/MacOS/Coda is what I used for the path (and that is where it is.)
What am I missing?



[ Reply to This | # ]
View Firefox page source in an external editor
Authored by: stevebr on Jan 07, '11 03:44:03PM

Great hint. TextMate users who want to do this may need to know that the command-line launcher is at the following path:

/Applications/TextMate.app/Contents/Resources/mate

But I just discovered that using the command line versions aren't necessary after all, if you set the external editor to "open" and also set an appropriate value in the preference "view_source.editor.args." For example, let's open the web page with TextEdit just for fun:

view_source.editor.external = /usr/bin/open
view_source.editor.args = -a TextEdit

You'll get the "such and such is an application downloaded from the internet..." quarantine message but it continues and opens if you approve the dialog.

I tested a couple of things and presumably you can open the file with any app that knows how to use a web page, so this might help with bloodnok's problem with Dreamweaver a couple of comments up.

I'm guessing you could also use this as a poor man's SiteSucker if you set your "editor" to wget and passed the appropriate arguments.

Wouldn't have seen the args setting if it weren't for this hint. Thanks.



[ Reply to This | # ]
View Firefox page source in an external editor
Authored by: bloodnok on Jan 10, '11 11:36:09AM

that should be a neat trick but rather than fixing dreamweaver, it breaks the default fall-back to viewing in firefox ...

must have something to do with dreamweaver.



[ Reply to This | # ]
View Firefox page source in an external editor
Authored by: bloodnok on Jan 10, '11 11:41:02AM

even better, tried "-a Adobe\ Dreamweaver\ CS5.app" to no avail (although that does work on the command line).



[ Reply to This | # ]
View Firefox page source in an external editor
Authored by: plowedu on Jan 10, '11 08:43:36AM

I couldn't get it to work with Coda either using the suggested path.
/Applications/Coda.app/Contents/MacOS/Coda



[ Reply to This | # ]
Carko wrote: "I liked the source editor in OmniWeb"
Authored by: MacUser06 on Jan 10, '11 04:25:08PM

OmniWeb is upgraded to use WebKit 4.1 and is still free ….

I use BBedit with Safari by a javascript bookmark to edit the current page.
I used the WebPageHelper at MacOsxAutomation.com. My code is far to ugly to post it here.

Edited on Jan 10, '11 04:25:55PM by MacUser06



[ Reply to This | # ]