搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

Firefox won't open my local html files as webpages, just shows the html code. Why?

  • 5 回覆
  • 2 有這個問題
  • 10 次檢視
  • 最近回覆由 cor-el

more options

I'm trying to set up a very basic website, and just to test some things out, cut and pasted a one-line website from W3schools.com. It was just an introductory HTML page. I saved it in TextEdit as an .html file and tried to open it in Firefox. However, Firefox opened it but instead of displaying as a web page, just displayed the html coding. Then I tried it in Safari, but it does the same thing. What's going on here? How can I develop pages if I can't even see what I'm doing?

Thanks!

I'm trying to set up a very basic website, and just to test some things out, cut and pasted a one-line website from W3schools.com. It was just an introductory HTML page. I saved it in TextEdit as an .html file and tried to open it in Firefox. However, Firefox opened it but instead of displaying as a web page, just displayed the html coding. Then I tried it in Safari, but it does the same thing. What's going on here? How can I develop pages if I can't even see what I'm doing? Thanks!

所有回覆 (5)

more options

Hi Karin, when you open a file from disk, Firefox may need an extra clue that it is an HTML file. In particular:

- Did you give the file name a .html extension? - Does the file have the typical tags around the content that you're experimenting with:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Page Title</title> </head> <body> Your content here </body> </html>

more options

Sorry, you did mention adding an .html extension.

Maybe this is a peculiar behavior of TextEdit. Try this: save any web page to the folder where you are editing, and then open the web page in TextEdit and replace its content with the content of your example website and save the file. Hopefully then it will be recognized as an HTML file.

If not, you could try a better editor or seek help on Apple's forums.

more options

Thanks, I tried that and it just shows a whole page full of html code (from the example site).

I have no idea what's going on.

more options

Can your Firefox open other saved .html files successfully? In case this is not a problem caused by TextEdit...

more options

Did you try to save the page in Firefox as an HTML file?

Do pages that you save from internet load properly?

Did you check your security software?

Did you make sure that the servers sends the file as text/html in case you aren't loading the file directly in Firefox, but load the file via localhost?

Also make sure that you have HTML tags and not entities (&lt; and &gt;) in the file.