Opening html code rather than web page
I am using Firefox 8. I have a simple html file called test.html stored locally.
When I double click on the file it open in Firefox as html code rather than the web page. What am I doing wrong?
Wubrane rozwězanje
I have resolved the issue. The file was working correctly. I made the mistake of coding html in a text file and then saving the file as html. This resulted in the html tags being coded a second time with html. Hence being able to view html tags in the web page.
Toś to wótegrono w konteksće cytaś 👍 0Wšykne wótegrona (13)
Are you loading that file via a local server via the http:// protocol or as a file via the file:///protocol?
If it is via a server then make sure that the file is send as text/html
I don't know which protocol is being used. How do I find out?
I am not using a server - just my own Mac.
Which URL so you see in the location (address) bar if you open the file? If it starts with http:// then it is opened as a web page and not as a file.
Also make sure that the file doesn't have a .txt file extension i.e. test.html.txt that is possibly added if you save a file in a text editor.
Hello
after replying to you, I looked further than my nose and noticed that the URL starts with file:/// The file suffix is definitely html (yes it was edited in text edit but I did a 'save as' html).
What determines what protocol is being used? Is there a setting that I need to change? I thought that the Mac would recognise that it's a html file (from the file suffix) and load as a web page into browser.
I have not activated the web server on my mac. Is this the problem?
Firefox should automatically display .html files rendered and not as text files even if loaded with the file protocol.
Can you post the first few lines of that file?
It's very simple as I'm just starting to learn. I copied it from a site to test the html.
<html> <head> </head> <body> <h2>My first webpage!</h2> </body> </html>
Wót cor-el
I just noticed that my reply above converted the html to web. Useful!
I copied it again and removed the first and end bracket for the html tag.
html>
<head> </head>
<body>
My first webpage!
</body>
So, there is nothing wrong with the file.
What do you see in Tools > Page Info > General ?
I have added a screenshot below to show Tools > Page Info > General
Does this explain the problem?
That still doesn't show that there is a problem: opened as text/html and rendered in Standards compliant mode.
Start Firefox in Diagnose Firefox issues using Troubleshoot Mode to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
- Don't make any changes on the Safe mode start window.
- https://support.mozilla.com/kb/Safe+Mode
I tried this (Firefox looks weird as I have customised it to some degree!)
It didn't fix the problem. I double clicked on test.html and it open showing the html tags and the file:/// protocol.
I am currently considering changing career to website design/development but am wondering if this is feasible when I can't even get a 6 line html file to work!!
I also tried it in Safari 5.1.1. The same problem occurs. Is this suggesting a Mac problem rather than Firefox?
Wubrane rozwězanje
I have resolved the issue. The file was working correctly. I made the mistake of coding html in a text file and then saving the file as html. This resulted in the html tags being coded a second time with html. Hence being able to view html tags in the web page.