Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Este site está com funcionalidades limitadas enquanto realizamos manutenção para melhorar sua experiência de uso. Se nenhum artigo resolver seu problema e você quiser fazer uma pergunta, nossa comunidade de suporte pode te ajudar em @FirefoxSupport no Twitter e /r/firefox no Reddit.

Pesquisar no site de suporte

Evite golpes de suporte. Nunca pedimos que você ligue ou envie uma mensagem de texto para um número de telefone, ou compartilhe informações pessoais. Denuncie atividades suspeitas usando a opção “Denunciar abuso”.

Saiba mais

Esta discussão foi arquivada. Faça uma nova pergunta se precisa de ajuda.

Opening html code rather than web page

  • 13 respostas
  • 10 têm este problema
  • 1 exibição
  • Última resposta de serky100

more options

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?

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?

Solução escolhida

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.

Ler esta resposta 👍 0

Todas as respostas (13)

more options

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

more options

I don't know which protocol is being used. How do I find out?

I am not using a server - just my own Mac.

more options

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.

more options

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?

more options

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?

more options

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>

Alterado por cor-el em

more options

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>

more options

So, there is nothing wrong with the file.

What do you see in Tools > Page Info > General ?

more options

I have added a screenshot below to show Tools > Page Info > General

Does this explain the problem?

more options

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).

more options

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!!

more options

I also tried it in Safari 5.1.1. The same problem occurs. Is this suggesting a Mac problem rather than Firefox?

more options

Solução escolhida

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.