On Mac, I created a local .html document, but in the browser I just see the HTML source

On Mac, I created a file with very simple html, for example. <h1>my web page</h1> I save it as .html. I am running firefox or Opera and I am using an open file, but I just see the content as an html source, for example. I see <b> tags, etc.

If you need all the code here:

 <html> <head> </head> <body> <h1>My Web Page</h1> </body> </html> 

Edit: Rich Text format was a problem. See my answer below.

+4
source share
3 answers

In fact, Shad was on the right answer.

The problem was that I used a standard text editor - textedit - and it saved the document type as formatted text formatting (standard). I had to go into text settings and make default formatting changes for a new document from Rich Text to plain text. This fixed the problem! Since this was a silly problem, but not obvious to most, I will post a screenshot where you change the preference of the new document by default in the textedit prefixes.

enter image description here

+4
source

Perhaps due to some dumb header. Browsers use header information to decide how to do this, rather than an extension, I think. You know, there is a tiny chance that any exe, jpg, png, txt- file can actually be displayed as valid HTML, because both of them are just files at heart.

0
source

Open the “Get Information” file by right-clicking on the file (or press “Ctrl”) and selecting “Get Information”. Under the heading "Name and extension", uncheck the box next to "Hide extension." You will see that Mac has added the extension (usually .txt), just uninstall this extension and close

-1
source

Source: https://habr.com/ru/post/1401041/


All Articles