Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Operating System (http://www.mac-forums.com/forums/os-x-operating-system/)
-   -   Opening Local HTML files - render HTML (not display as text) (http://www.mac-forums.com/forums/os-x-operating-system/174127-opening-local-html-files-render-html-not-display-text.html)

Gator626 11-01-2009 07:17 PM

Opening Local HTML files - render HTML (not display as text)
 
Hello everyone,

I am somewhat new with web development on a mac, and am running into some issues trying to test my HTML. I create an HTML file and save it to my local file system. When I open it in a web browser (Firefox and Safari), the page displays the literal HTML text instead of rendering the HTML into a web page like it should.

Is there a setting somewhere on the Mac OS that can overturn this?

Thanks.

vansmith 11-01-2009 07:20 PM

You should have no problem with opening html files in your web browser. Are you saving them with the html extension (.html or .htm)?

Gator626 11-01-2009 07:25 PM

Thanks for the quick reply
 
Thank you for the quick response.

Yes, the file had a .html extension. The file info displays as "HTML Document". However, even the preview just displays the literal HTML text. Very frustrating, considering this is such a trivial issue on a PC. Is there a setting in the Apache Web Server on OS X that is running a style transform on local HTML documents to cause the literal text to be displayed?

Another thing to add: when I view the page source, it appears additional HTML has been added so that the page will display the literal HTML. Makes zero sense.

Pardon my frustrations.

Dysfunction 11-01-2009 07:35 PM

I don't believe the Preview application does HTML rendering. Now, why the browsers are not rendering html? I've no idea... generally when I've seen that it was a code issue...


edit: are you browsing this through the filesystem or through the webserver?

Gator626 11-01-2009 07:39 PM

Quote:

Originally Posted by Dysfunction (Post 935657)
I don't believe the Preview application does HTML rendering. Now, why the browsers are not rendering html? I've no idea... generally when I've seen that it was a code issue

I tried it with a very basic HTML file
<html>
<head />
<body>abcd</body>
</html>

And it does the exact same thing (displays tags & text as a literal text file). Make little sense to me as well, and I doubt it is browser specific since Safari and Firefox are both doing it. Almost tempted to chalk up the loss and scrap the mac from a web development standpoint, because this is way too trivial to be spending a lot of time trying to troubleshoot.

Dysfunction 11-01-2009 07:58 PM

I just copied that into textedit and saved it as html... it did the same as you described... so I did a cat -v

Code:

mikeMbp:Desktop mike$ cat -v Untitled.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Author" content="Mike">
  <meta name="Copyright" content="Mike">
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="1038.11">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
  </style>
</head>
<body>
<p class="p1">&lt;html&gt;</p>
<p class="p1">&lt;head /&gt;</p>
<p class="p1">&lt;body&gt;abcd&lt;/body&gt;</p>
<p class="p1">&lt;/html&gt;</p>
</body>
</html>
mikeMbp:

So i edited out the cr@p in vi.

Code:

mikeMbp:Desktop mike$ cat -v Untitled.html

<html>
<head>
<title></title>
</head>
<body>
abcd
</body>
</html>

and it works. It's not the mac, it's textedit (which I think sucks anyway) try textwrangler, it's LEAPS and BOUNDS better as an editor.

Alternately you can (in textedit) go to Format > Make Plain Text


I hate rich text biased editors.

Gator626 11-01-2009 08:00 PM

Thanks for the suggestion! You are right -- it probably is the text editor. I have been using komodo edit, but haven't really found it very intuitive. I will take a look at text wrangler.

Thanks again!


All times are GMT -4. The time now is 01:19 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.