On a Mac, I created a file with some very simple html, e.g. <h1>my web page</h1>
I save it as .html. I start firefox or Opera and I use open file, but I just see the content as html source, e.g. I see <b>
tags, etc.
If you want all the code here it is:
<html>
<head>
</head>
<body>
<h1>My Web Page</h1>
</body>
</html>
Edit: 'Rich text' format was the issue. See my answer below.
View an HTML document In the TextEdit app on your Mac, choose File > Open, then select the document. Click Options at the bottom of the TextEdit dialog, then select “Ignore rich text commands.” Click Open.
This HTML isn't being interpreted as plain text: it's being interpreted as HTML. It's just that the contents of your HTML include markup that has been escaped, such as < and > .
Use The Open With Command Find the HTML file you want to view, right-click on it, and choose Open with from the menu. You will see a full list of apps that you can use to run your file. Your default browser will be at the top of the list. Select Google Chrome from the list, and view your file in the browser.
Possible Reasons: You might not have saved the changes after writing the code (most likely). Problem with the browser (load it in another browser) Check the extension (just for clarification)
Shad was actually on to the right answer here.
The problem was that I was using the standard mac text editor - textedit
- and it was saving the document type as rich text formatting (the standard). I had to go into textedit preferences and make change the default formatting for a new document from Rich text to Plain text. This fixed the problem!
As this was a stupid problem, yet not obvious to most I'll post the screen shot of where you change that default new document preference in textedit prefs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With