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!
Hi, much easier way is to open html file in browser and “view source code” if you don’t have this option – you can install extension to your browser and you’ll see all codes
That lets you view it, Brentt, but it doesn’t let you edit it!
Im just sitting here looking at the screen shots and wondering what internet explorer is doing on a Mac. lol But thanks for the help.
Hi Dave,
Nice name.
Text edit doesn’t open the file. it’s still a mess of crap.
Regards ,
Dave Nelson
Hi Dave
I just came over from htm.net, cubesquared directed me to you with the above link.
I managed to solve the above problem with your help (thanks) but my page, opened as a ‘file:’ link through firefox, does not show the colour(color).
Cubesquared (at html dot net) checked my code and said it was fine and the file shows the colour in the Finder preview, when just browsing the docs, so what am I doing wrong?.
Thanks in advance
Des
If it’s opening as a file:// link, then you’re seeing the local copy on your computer, not the copy on the cubesquared server that you uploaded. Ask them for the URL of your pages on their server and make sure you don’t bounce back to local (which no-one else will be able to see)
Hi Dave
Do you know, at no point have I been told that I have to upload a file to a server at this stage, I thought I should be able to see the file as It would be seen on a web page while previewing it, which is what I thought was happening when I was told to onpen as a ‘file’ through my browser.
The teaching website is called html.net the moderator is cubesquared.
Non the wiser
Des
Hi Dave
Just figured it out
In Firefox, settings, content, colours;
I had unticked(checked) the box that allowed websiteds to use thier own colour, some time in the past.,
Phew.
Thanks
Des
Dave, your the man! Trying to figure out how to convert .html files to read them in TextEdit has been driving me crazy, your instructions were easy to follow.
Cheers, Dave. You’re a lifesaver… or at least an afternoon saver! 🙂
Thank you so much for the detailed instructions!!
Not fluent in HTML I just edited – a small tweak to the text – the formatted version in TextEdit and now I have a file with the HTML but won’t render well in the browser. Any suggestions on how I fix this? I’m learning HTML.
Thank you so much…helped me! 🙂
Just want to say thanks for putting up such useful information in such a completely clear way!
OH MY GOD i was insane
THANK YOU !!!!
Thanks so much for the information. I was able to save the preferences in Text Edit and all is well. Wish I would have found you earlier. Thanks again for your help.