Saving from Textedit as .html

Joined
Nov 30, 2008
Messages
4
Reaction score
0
Points
1
Well,

On Windows I can write html code in Notepad and save it as .html, open it with a browser and I see the page as the html dictates I should.

On this Mac I've gotten recently I've tried writing html in Textedit and saving it as an html file, and opening it with a browser - and I see only what I wrote, meaning the code itself. For example, in a file I had <body bgcolor="yellow"> and instead of the background being yellow I saw "<body bgcolor="yellow">" on the page when I opened the browser.

How could I be able to simply write simple html code in a word processing program like Textedit and, when I open it locally, have the browser actually recognize the code and execute it?

Thanks,
Oijl
 
Joined
Jun 18, 2006
Messages
191
Reaction score
5
Points
18
Location
Minneapolis
Your Mac's Specs
MacBook Pro
When you save the file use "save as" and choose html from the dropdown.
 
OP
O
Joined
Nov 30, 2008
Messages
4
Reaction score
0
Points
1
That's what I did, I mean. And when I open that html file, it opens with a browser, but I just see the code itself.
 

CrimsonRequiem


Retired Staff
Joined
Jul 24, 2008
Messages
6,003
Reaction score
125
Points
63
Your Mac's Specs
MBP 2.3 Ghz 4GB RAM 860 GB SSD, iMac 3.4 GHz Intel Core i7 32GB RAM, Fusion Drive 1TB
Under preferences what are your settings?
 
OP
O
Joined
Nov 30, 2008
Messages
4
Reaction score
0
Points
1
Ah. Is that what it is?

My settings for Textedit are, for html saving, no css, html 4.0.1 strict, UTF-8 encoding.

Should they be something else?
 

CrimsonRequiem


Retired Staff
Joined
Jul 24, 2008
Messages
6,003
Reaction score
125
Points
63
Your Mac's Specs
MBP 2.3 Ghz 4GB RAM 860 GB SSD, iMac 3.4 GHz Intel Core i7 32GB RAM, Fusion Drive 1TB
Well I just experimented with the text edit and it seems to do some pretty weird stuff.

First off your preferences are fine.

What I found was that when I did File->Save As... and then changed it to html and I open the file, I see the code.

However when I leave the file format at rich text or whatever and just add .html to the end of the file name it works.
 
OP
O
Joined
Nov 30, 2008
Messages
4
Reaction score
0
Points
1
Mmm, thanks! That works, it does what it should, but there's also this long string of text that shouldn't be there.

Specifically, to test if this would work I made a file that contains:

<html>
<body bgcolor="orange">
</body>
</html>

and when I save it as .rtf and then change the file to .html, and open it with a browser, the background is orange, but I can see the text:

{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf350 {\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww9000\viewh8400\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural \f0\fs24 \cf0 \ \ \ }

as well.

How should I solve this problem, do you think?
 
Joined
Sep 23, 2006
Messages
246
Reaction score
3
Points
18
Honestly I have had this problem before and to fix it i just got the program SMULTRON. It is a text editor taht also allows HTML, Scripting etc.

Tuppis - Smultron by Peter Borg

I like it so far, and it allows for a variety of coing helps like numbered lines etc.
 
Joined
Nov 16, 2008
Messages
47
Reaction score
0
Points
6
You should be able to save by just doing (filename).html

Or another alternative is textWrangler.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top