Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newConvert

macrumors regular
Original poster
Aug 25, 2006
214
3
Hello,

I am trying to write a basic web page in text editor, i saved it as an html file, but whenever i open it up in a browser it just displays the code behind the page, not what the actual page should look like. How do i get it to render the page properly? It seems to do this in all the browsers. I dont have javascript in there yet, but will shortley, so it has to be able to do that properly as well... Sorry if this is a stupid question!!
 
The only thing I can think of is that you still must have some open tags somewhere... I do very little hand coding, but when I did, I always forgot to close tags.
 
Hello,

I am trying to write a basic web page in text editor, i saved it as an html file, but whenever i open it up in a browser it just displays the code behind the page, not what the actual page should look like. How do i get it to render the page properly? It seems to do this in all the browsers. I dont have javascript in there yet, but will shortley, so it has to be able to do that properly as well... Sorry if this is a stupid question!!

Are you actually saving the page to your we.g. Apache Webserver document root? This is how the browser gets to interprete the markup language and render the page.
 
Are you actually saving the page to your we.g. Apache Webserver document root? This is how the browser gets to interprete the markup language and render the page.


nope.... i was just saving it in my documents folder... can't you do that? thats how i always used to test em on my windows machine.... sorry to sound like a noob, but what is the we.g. apache webserver document root? Thanks!!
 
nope.... i was just saving it in my documents folder... can't you do that? thats how i always used to test em on my windows machine.... sorry to sound like a noob, but what is the we.g. apache webserver document root? Thanks!!

Depending on the web page editor that you're using, some of them will allow you to preview the page and give you a good view of what the page would actually look like on the web.

However you would need a local webserver to properly test the pages. Apologies if the following explanation is a bit too simple - not too sure of your level of expertise in this area. A webserver is a program (eg Apache, IIS) that handles http requests - you put the pages you want to view in its htdocs directory and then point your browser at the pages using an address of the format http://localhost/index.html etc and 'boom' your pages show up in the browser.
 
Depending on the web page editor that you're using, some of them will allow you to preview the page and give you a good view of what the page would actually look like on the web.

However you would need a local webserver to properly test the pages. Apologies if the following explanation is a bit too simple - not too sure of your level of expertise in this area. A webserver is a program (eg Apache, IIS) that handles http requests - you put the pages you want to view in its htdocs directory and then point your browser at the pages using an address of the format http://localhost/index.html etc and 'boom' your pages show up in the browser.

thanks... but how come you can just create your page in notepad (in windows) save it to your desktop, then just launch it from there? how come it renders the page then, but not if i do the same thing on a mac?
 
thanks... but how come you can just create your page in notepad (in windows) save it to your desktop, then just launch it from there? how come it renders the page then, but not if i do the same thing on a mac?

You've got to remember that with different browsers i.e. IE/Safari - there will be different different behaviours. I'm working on the assumption that you're using Safari or Firefox on the Mac and IE on Windows.
 
newconvert, you are most likely using TextEdit, and your TextEdit preferences needs to be changed to not save in rtf format (or whatever format is the default). Make sure TextEdit save as plain text and you'll be golden.

Had the same issue myself back in December when I first got my Mac.

Todd
 
newconvert, you are most likely using TextEdit, and your TextEdit preferences needs to be changed to not save in rtf format (or whatever format is the default). Make sure TextEdit save as plain text and you'll be golden.

Had the same issue myself back in December when I first got my Mac.

Todd

I was having the same problem, thank you.
 
Did you mention that you're using text edit?

I just did a simple experiment creating an HTML file using text edit.
I got the same problem, where the HTML tags you typed are shown as is.

However, if you try to view source on your browser, you'll see that text edit actually tried to be smart and converted all your HTML contents into what you'll see.

That means, converting < to < and > to > and all that.

And that's what caused the problem.

How to fix it? I'm not sure since text edit doesn't give the option to save the file as plain text. Or, if it does, I can't seem to find it anywhere...

However, I would suggest if you want to hand code, give smultron a try. That's what I use and I think it's a good one.

Or, if you just want something simple and quick, give taco software a try as well.


FYI, you don't need to run any server to display HTML pages on any browsers. HTML files that don't require server processing can be displayed as is just by opening the file from your browser.


-stndn.
 
How to fix it? I'm not sure since text edit doesn't give the option to save the file as plain text. Or, if it does, I can't seem to find it anywhere...
-stndn.

In the Format menu is the item "Make Plain Text" which will remove RTF formatting.

Why there is no plain text option in the Save dialog you need to ask of Apple.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.