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!

본 사이트는 여러분의 사용자 경험을 개선하기 위해 유지 보수를 진행하는 동안 기능이 제한됩니다. 도움말로 문제가 해결되지 않고 질문을 하고 싶다면 Twitter의 @FirefoxSupport 및 Reddit의 /r/firefox 채널을 활용하세요.

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

Opening html code rather than web page

  • 13 답장
  • 10 이 문제를 만남
  • 1 보기
  • 최종 답변자: 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?

선택된 해결법

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.

문맥에 따라 이 답변을 읽어주세요 👍 0

모든 댓글 (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>

글쓴이 cor-el 수정일시

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

선택된 해결법

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.