Can t open html file on mac

The solution provided by Xiaoou Wang works.

Explanation

I would like to extend this answer and provide below a different solution, which was not given yet.

Chrome (Mac) indeed does not open .html files that have the extended attribute com.apple.quarantine. This attribute is automatically applied on files that are downloaded from the web and are not Apple-authorized applications.

From the terminal, by typing

xattr 'your .html file name'

you can verify whether your .html file has the quarantine attribute set.

With xattr -c command you will remove all attributes, in case there are others set. If you want to only remove the quarantine attribute, type instead

xattr -d com.apple.quarantine 'your .html file name'

Alternative solution

This alternative solution might be even simpler for some people. With my Chrome (mac) I can open .html files by simply dragging the file from finder onto an already opened Chrome window, in spite of their com.apple.quarantine attribute. Important: It does not work if you drag the file onto Chrome's icon in the dock.

  • Global Nav Open MenuGlobal Nav Close Menu
  • Apple
  • Apple
  • Store
  • Mac
  • iPad
  • iPhone
  • Watch
  • AirPods
  • TV & Home
  • Only on Apple
  • Accessories
  • Support

Select version:

Modifying this control will update this page automatically

TextEdit User Guide

  • Welcome
    • Start new documents
    • Open documents
    • Save documents
    • Work with HTML documents
    • Hear documents read aloud
    • Format with fonts and styles
    • Adjust paragraphs
    • Insert line, paragraph, and page breaks
    • Change how text wraps
    • Print headers and footers
    • Set character and line spacing
    • Set default font
    • Use superscript or subscript
    • Add tables and lists
    • Insert special characters
    • Add photos, movies, and files
    • Annotate images
    • Check spelling and grammar
    • Find and replace text
    • See word completions
  • Change TextEdit preferences
  • Copyright

Can t open html file on mac

You can use TextEdit to edit or display HTML documents as you’d see them in a browser (images may not appear), or in code-editing mode.

Note: By default, curly quotes and em dashes are substituted for straight quotes and hyphens when editing HTML as formatted text. (Code-editing mode uses straight quotes and hyphens.) To learn how to change this preference, see New Document options.

Open TextEdit for me

Create an HTML file

  1. In the TextEdit app

    Can t open html file on mac
    on your Mac, choose File > New, then choose Format > Make Plain Text.

  2. Enter the HTML code.

  3. Choose File > Save, type a name followed by the extension .html (for example, enter index.html), then click Save.

  4. When prompted about the extension to use, click “Use .html.”

View an HTML document

  1. In the TextEdit app

    Can t open html file on mac
    on your Mac, choose File > Open, then select the document.

  2. Click Options at the bottom of the TextEdit dialog, then select “Ignore rich text commands.”

  3. Click Open.

Always open HTML files in code-editing mode

  1. In the TextEdit app

    Can t open html file on mac
    on your Mac, choose TextEdit > Preferences, then click Open and Save.

  2. Select “Display HTML files as HTML code instead of formatted text.”

Change how HTML files are saved

Set preferences that affect how HTML files are saved in TextEdit.

  1. In the TextEdit app

    Can t open html file on mac
    on your Mac, choose TextEdit > Preferences, then click Open and Save.

  2. Below HTML Saving Options, choose a document type, a style setting for CSS, and an encoding.

  3. Select “Preserve white space” to include code that preserves blank areas in documents.

If you open an HTML file and don’t see the code, TextEdit is displaying the file the same way a browser would (as formatted text).

Please don’t include any personal information in your comment.

Maximum character limit is 250.

Thanks for your feedback.

How do I open an HTML File on a Mac?

Always open HTML files in code-editing mode In the TextEdit app on your Mac, choose TextEdit > Preferences, then click Open and Save. Select “Display HTML files as HTML code instead of formatted text”.

Why is my HTML File not opening?

Check if the file is saved with a UTF-8 encoding. If that doesn't work, try installing another browser or using Edge/Safari/Internet Explorer or whatever built-in browser you have. It is saved as index.

How do I open an HTML File in Safari on a Mac?

Open Safari. Navigate to the web page you would like to examine. Select the Develop menu in the top menu bar. Select the Show Page Source option to open a text window with the HTML source of the page.

Can't open HTML File in Safari?

For Safari on iPads and iPhones, go into Settings > Safari > Advanced > and then enable Web Inspector. This will then allow you to access the Develop Menu as above and then disable local file restrictions. For more help with your web browser, check out our forum!