I wrote all of my web site’s code using SimpleText in MacOS 9. Recently I made the step up to OS X and I’ve transferred all of my data from my old G-4 to the new system. When I open the html pages in TextEdit on OS X I am unable to go in and edit the code. Instead I get a screen that reads the the html and presents a page like one would see on the web. Is it possible to edit the html that was written in SimpleText and still keep it as a text file?
There are a couple of ways you can address this problem. First off, in Mac OS X, files with “.html” filename suffixes are automatically associated with Safari, the Web browser, so if you double click on them, you don’t get to an editor at all.
To open a file in your editor, Control-Click on the file’s icon. You’ll see:
You can see here that, oddly enough, I have three different versions of TextEdit on my own computer running Mac OS X Tiger 10.4.2. Weird!
Anyway, that’s the general technique you can use to open any file in Mac OS X with any of the set of applications that are known to handle that particular file type.
To permanently change all “.html” files to open with TextEdit, instead of choosing “Open With…” you should choose “Get Info…” which reveals the following:
Notice the “Open with” area in the Get Info window. As you can see, the default is to open this file — and all files with this matching filename extension — with Safari. You can change that by selecting another application from the pop-up menu, then clicking Change All… .
Now, on to the specifics of your question. You ask why it is when you open up an HTML file that TextEdit shows you the formatted text rather than the actual HTML source. Great question!
Here’s what I see when I open a simple HTML file:
Not good. To fix this we’re going to have to change the Preferences, then quit and re-open the file. Fortunately, we’ll only have to do this once on your Mac. Go to TextEdit –> Preferences… and choose “Open and Save”. You’ll see:
The key is the first option under “When opening a file”: you want to check Ignore rich text commands in HTML files . Check that option, then quit TextEdit.
Now, open up the HTML file again, and here’s what you’ll see:
Much, much better.
It turns out you can also do this by manually selecting File –> Open… , choosing the file, and also selecting the option in the Open dialog window of “Ignore rich text commands”, but since i’m always double-clicking on files or otherwise launching TextEdit, it’s a much easier solution to simply fix the preferences and never worry about it again.
Kind of a pain, but that’s your solution path. Good luck with your editing!