Jump to content

opening html documents

Jakobhill's Photo
Posted Apr 17 2011 05:44 AM
3479 Views

I´m just getting started with "Creating a web site" which so far seems perfect for a beginner like myself.
I just made the "skeleton" for my own xhtml document according to chapter 2 and wanted to see how it looked in my browser (safari). The problem is that when I double click on the html document, (which I have saved as an html file), Safari seems to open the exact same text as written in Text Edit. It shows the entire text as displayed in TextEdit. I tried to validate the html document with Markup Validation service and it checked out.
I hope someone has an easy solution to my problem, as you can tell I´m a beginner at thios..

Tags:
3 Subscribe


4 Replies

 : Apr 18 2011 10:49 AM
Can you post the HTML code? Or better yet can you add the the file as an attachment here?
CR
=========================
Sent to you from my
iPad, iPhone, BlackBerry,
Laptop, Desktop, or
Kitchen Toaster
+ 1
  rachel.j's Photo
Posted Apr 19 2011 06:28 AM

It sounds like TextEdit isn't saving the file as a plain text html document (I believe TextEdit saves files as rich text by default). Here's what I think you'll need to do to:

  • Go to TextEdit > Preferences > Open and Save
  • Check Ignore rich text commands in HTML files
  • Uncheck Add ".txt" extension to plain text files (Your HTML files will need to be plain text, but they only need the file extension .htm or .html.)
  • Go to the New Document tab
  • Select Plain text as your Format for new documents

Here's a blog post that explains some of this.

Once you've created/edited a file with these settings, you should be able to open it in your browser and have it interpreted correctly.

This is a common problem, because a lot of text editors have default settings that aren't what you need for writing code. The book's editor is planning to add a note about this to future editions of the book.

Regards,

Rachel James
O'Reilly Media
+ 1
  DaveEveritt's Photo
Posted Apr 27 2011 11:50 PM

I would start using the free and very useful programmers' text editor TextWrangler for writing your code, instead of TextEdit.
 : Apr 28 2011 08:39 AM
Good point, Dave. I also use TextWrangler for development on a Mac. It's a good text editor, and it has tools like code coloring that are very useful for developers. And it's free!