Problems with HTML files

I am learning some HTML in school, and need to do work on my school device. I have found out ways to create the actual HTML files with TextEdit, but the files themselves don't display right. Whenever I use the a tag, it never works. I'm used to doing this on a Windows device, and it works perfectly (on all browsers.) I've tried, and tried again, on Safari, Chrome, and Firefox, I get the same results. Whenever I try to use a link, it comes up as a file that has been "Deleted." Safari does nothing, compared to Chrome and Firefox, but they try to open a file as if it's like this:


file:///Users/*********/Documents/Interwebs%20Projects/About%20Me/“https://www.w3schools.com/html/â€


I've tried MULTIPLE times, on different browsers, and different operating systems, my Mac is the only one that screws up my web browser so that the a tag links to a file, instead of my website!

MacBook Air, macOS Sierra (10.12.6), School Device

Posted on Nov 21, 2017 11:49 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 25, 2017 8:06 PM

if you are stuck using TextEdit, you need to set the preferences appropriately for writing HTML.

Under New Document, set it to Plain Text and under Open and Save, check the option to show HTML files as code.

You can check the format of the file in the Format menu. If it says Make Plain Text, then select that menu command to change it to plain text. By default, TextEdit uses Rich Text which will cause all sorts of problems.


When you save, it may ask if you if you want to use txt instead of html. If so, uncheck the preference to add .txt extension to files.


With those settings, you should be able to write HTML and save it as a valid file.

11 replies
Question marked as Top-ranking reply

Nov 25, 2017 8:06 PM in response to onlywindowsuseronhere

if you are stuck using TextEdit, you need to set the preferences appropriately for writing HTML.

Under New Document, set it to Plain Text and under Open and Save, check the option to show HTML files as code.

You can check the format of the file in the Format menu. If it says Make Plain Text, then select that menu command to change it to plain text. By default, TextEdit uses Rich Text which will cause all sorts of problems.


When you save, it may ask if you if you want to use txt instead of html. If so, uncheck the preference to add .txt extension to files.


With those settings, you should be able to write HTML and save it as a valid file.

Nov 25, 2017 8:03 PM in response to PN2

Just to make sure : you are using TextEdit in plain text format, right ? : TextEdit - Format menu - Make Plain Text


There's a setting in TextEdit - Preferences - New Document - Format to make it start how you want it to; and one in

TextEdit - Preferences - Open and Save to force it to Display HTML as code rather than formatted text.


TextEdit is perfectly capable of producing functional HTML & other plain text code. It lacks bells & whistles like color coding & auto-indenting & syntax checking & easy comment support etc etc… but that's actually quite a good thing when starting out.

Nov 21, 2017 4:31 PM in response to onlywindowsuseronhere

Can you show us the exact code you used ?.


I used textedit to create an html file with just this content and it worked as expected in Safari 11.0.1 Firefox 57 and Opera 49


https://pastebin.com/yTgEfNRm



It sounds as if you're trying to link to a website page, rather than a local file, so what is the URL of that page ?.


*** edited since the code was active, rather than visible html. ***

Nov 25, 2017 7:47 PM in response to onlywindowsuseronhere

onlywindowsuseronhere wrote:


but they try to open a file as if it's like this:


file:///Users/*********/Documents/Interwebs%20Projects/About%20Me/“


https://www.w3schools.com/html/â€


Here is the code I was trying to write. The asterisks were placed for protection.


Likewise, I see nothing.


HTML is not rocket science. I can see the links as you posted above, both have garbage at the end of the string.

(This looks like a classic case of unicode (UTF-8 most likely) characters being interpreted as iso-8859-1 or some such.)

and as suggested above try a true text editor.

Of course I can not see the local file on your machine: file:///Users/

and, if the web based file does not parse, ( after removing the garbage or amending ) : https://www

then remove the www. and try : http://

ex. https://w3schools.com/html/

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Problems with HTML files

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.