On a Mac, I created a .html document locally but in a browser I just see HTML source

10,247

Shad was actually on to the right answer here.

The problem was that I was using the standard mac text editor - textedit - and it was saving the document type as rich text formatting (the standard). I had to go into textedit preferences and make change the default formatting for a new document from Rich text to Plain text. This fixed the problem! As this was a stupid problem, yet not obvious to most I'll post the screen shot of where you change that default new document preference in textedit prefs.

enter image description here

Share:
10,247
junky
Author by

junky

Full Stack programmer with a thirst for learning

Updated on July 20, 2022

Comments

  • junky
    junky almost 2 years

    On a Mac, I created a file with some very simple html, e.g. <h1>my web page</h1> I save it as .html. I start firefox or Opera and I use open file, but I just see the content as html source, e.g. I see <b> tags, etc.

    If you want all the code here it is:

    <html>
    <head>
    </head>
    <body>
      <h1>My Web Page</h1>
    </body>
    </html>
    

    Edit: 'Rich text' format was the issue. See my answer below.

  • junky
    junky about 12 years
    Thanks. Yes I did this and it didn't help. i tried .html .htm and no extension and I check each one with finder properties, none are working.
  • junky
    junky about 12 years
    -1 because I did not see the .txt so this was not a fix (though I appreciate the help as always).
  • junky
    junky about 12 years
    Totally makes sense. I can change the extension but that isn't this. How do I actually change the header information ?
  • stanimirsp
    stanimirsp over 3 years
    It works, need only to add that these settings won’t take effect on the current work. New html file must be created.