Skip navigation

Xserve G5 displays HTML source code instead of HTML page?

385 Views 6 Replies Latest reply: Aug 21, 2013 7:24 AM by Athk10 RSS
Athk10 Calculating status...
Currently Being Moderated
Aug 19, 2013 9:50 AM

My Xserve G5 running OS X 10.5 will not display HTML properly through the Web service in my Admin application. I am simply trying to display a single HTML page, which I have named index.html. It is the only file in /Library/WebServer/Documents/. I have also tried pointing to my Sites folder, yet it yields the same result. Thanks

  • Simon Slavin Level 4 Level 4 (1,390 points)

    It is possible to make this happen on purpose, by messing up the MIME configuration of your web server.  When a web server returns a page it also returns a MIME type for it so that the browser knows what do to with it.  The mime type that should be returned for an HTML page is 'text/html', but if your server is instead returning 'text/plain' or no MIME type at all then the browser may simply display the page as text.

     

    Take a look at your server stup.  Did you modify any of the configuration, especially anything that mentions MIME ?

     

    If your browser has a 'debug' feature see if you can get it to show you the MIME type that was returned with the page.  Or you can use this command

     

    curl -I http://my.url

     

    in Terminal and it will show you various things about the page returned.  If this shows that the MIME type is correct then it's more likely that the bug is in your web browser than in your server setup.

     

    Another problem may come with strange characters in your web page.  If you have edited your web page 'index.html' with a word processor (e.g. Word) rather than a text processor (e.g. TextEdit) then strange characters may have sneaked in there which make it impossible to render correctly.  This might cause a browser to give up and show it as text instead.

  • Simon Slavin Level 4 Level 4 (1,390 points)

    There's nothing wrong with that homepage as seved by your server.  If it looks funny in your browsers then there's something wrong somewhere else.

     

    No, you're not using Rich Text formatting as HTML.  TextEdit is writing HTML code for you, since you tried to edit an HTML source file.

  • Simon Slavin Level 4 Level 4 (1,390 points)

    As you have seen from the 'show source', TextEdit is no longer saving in HTML mode.  TextEdit does not know how to encode the new things you put in the file as HTML so it is not saving in HTML mode.  It's saving the text you put in as text, and then, because you told it to, making a web page which shows that text.  It's possibly the 'iframe' that TextEdit doesn't know how to present.

     

    You either need to use a proper WYSIWYG HTML file editor or learn HTML and do your editing yourself by messing with the HTML code.

     

    You can still use TextEdit to hand-edit the code by changing this setting:

     

    TextEdit

    Preferences...

    Open and Save tab

    Ignore rich text commands in HTML files <-- untick this box

     

    then try opening the file again and you'll see the text that's really in the file.  You can copy the text so far out of your existing browser window.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.