HTML help!

Cougar

Enlightened Member
Joined
Nov 28, 2015
Messages
5,415
Reaction score
3,144
Location
North Idaho
Guild Total
5
This is driving me BONKERS. I've written html for simple webpages before. The pages WORK, i.e., they render in a browser (well, after I load them into a commercial host).

So I viewed the page source of one of those pages and then 'selected all' and copied the entire source code. Then pasted that html source code into a blank MS Word doc (or a textedit doc -- I've tried both).

Now, I made some minor changes to the html code, and I want to view what it will look like as a webpage, but prior to uploading it into the host. A test if you will. All indications say I should save the new code as a file with ".html" as the extension. Both Word and textedit ask how I want to save the file and offer the choice of giving it the .html extension, which I did. Then I should be able to open the file in firefox and see what the webpage looks like, right?

No! What I see in firefox is the html code! I don't want to see the damn code, I want to see the webpage the code produces! WHAT am I doing wrong?
 

chazmo

Super Moderator
Gold Supporting
Joined
Nov 7, 2007
Messages
26,205
Reaction score
7,583
Location
Central Massachusetts
Try using a file for source code, Cougs. E.g., in the navigation bar:

file:///filename.html

(depends on where the file is on your machine)
 

Cougar

Enlightened Member
Joined
Nov 28, 2015
Messages
5,415
Reaction score
3,144
Location
North Idaho
Guild Total
5
After a zillion trials and errors, I saved the file as a text file, NOT an html file, and then forced the .html extension onto it ("Are you sure you want to do that?"), then opened in firefox. Showed up as it would on the web. Finally. Let's see if I can get back to the file with the coding in it so I can keep coding, lol.
 

chazmo

Super Moderator
Gold Supporting
Joined
Nov 7, 2007
Messages
26,205
Reaction score
7,583
Location
Central Massachusetts
After a zillion trials and errors, I saved the file as a text file, NOT an html file, and then forced the .html extension onto it ("Are you sure you want to do that?"), then opened in firefox. Showed up as it would on the web. Finally. Let's see if I can get back to the file with the coding in it so I can keep coding, lol.
Cougs, I wouldn't think that using Word as a text editor is the way to go. Although if you can save your work as text, perhaps it's fine.

Years ago, when I had to do any work on Windows (I feel sorry for you) I used a Microsoft development called called Visual Studio to do some code development (not HTML)... You might look into that if you're going to continue with this.

G'luck.
 

GAD

Reverential Morlock
Über-Morlock
Joined
Feb 11, 2009
Messages
23,133
Reaction score
18,807
Location
NJ (The nice part)
Guild Total
112
Try vi in Linux. :)

Seriously, though, anything but Word. I suspect Windows was trying to outsmart you. Do you have “hide file extensions” disabled? If not then you can easily end up with filenames like myfile.html.docx and it’s not obvious since the OS hides the .docx.
 

James Hart

Member
Joined
Nov 9, 2020
Messages
355
Reaction score
719
Location
Beemerville, NJ
Guild Total
3
If sticking with and MS product, try VScode https://code.visualstudio.com/ it has become the industry standard (even on Linux) for coding.

GAD, you strike me as more of an Emacs guy! I catch myself trying Vim commands in notepad, etc when I've spent too many hours in konsole and/or ssh during the day :)

After decades of giving up on Linux as a desktop, I've actually been running Ubuntu Studio since the summer on my main computer... haven't found any reason to go back to windows yet.
 

James Hart

Member
Joined
Nov 9, 2020
Messages
355
Reaction score
719
Location
Beemerville, NJ
Guild Total
3
And, god willing, you never will.

considering last go at it was Blackbox on Debian... circa 2001-2, this is MUCH improved! I've got an i9 Dell laptop with 32gb of ram and a 2tb drive... I upgraded it to 11 and instantly regretted it, since I needed to wipe it to cleanly go back to 10 anyway... I figured a week or 2 on Ubuntu Studio I'd been dying to give a spin wouldn't hurt. I still have my archaic 6-core AMD based tower I built about 10 years ago with a bunch of data drives still in it, but I think I'm ready to mount them in an external case and retire it for good.
 

GAD

Reverential Morlock
Über-Morlock
Joined
Feb 11, 2009
Messages
23,133
Reaction score
18,807
Location
NJ (The nice part)
Guild Total
112
If sticking with and MS product, try VScode https://code.visualstudio.com/ it has become the industry standard (even on Linux) for coding.

GAD, you strike me as more of an Emacs guy! I catch myself trying Vim commands in notepad, etc when I've spent too many hours in konsole and/or ssh during the day :)

After decades of giving up on Linux as a desktop, I've actually been running Ubuntu Studio since the summer on my main computer... haven't found any reason to go back to windows yet.

I have a rule that I set for myself decades ago, which is to always be very familiar with the lowest level most powerful tool available. As a consultant, if I had to work on someone's Linux or Free BSD system there was no guarantee that Emacs would be available, but vi was always there. At one time I was even good with ed, but that was a long time ago. :) I even use the h j k l keys for cursor movement because I couldn't assume that a keyboard (be it PC, terminal, or emulator) back then had arrow keys or if it did, then I couldn't assume that they were encoded correctly.

I am also a huge fan of regular expressions, in large part to my love of vi. I can do things in seconds in vi that would take me minutes or longer in just about any other text editor. I've literally written webpages in vi and still program in it to this day unless I'm forced into something else, such as when coding C++ for Arduino. I've met developers that couldn't function without their favorite IDE and as someone who learned Assembly on punch cards, that just makes me sad.

It is rather comical watching me use something as simple as email after a day with vi because I end up with stuff like :1,$s/\<.*\>//g in my replies. :) It doesn't work well on complex stuff anyway, but old habits die hard.

I am very familiar with Emacs control characters, though. I used to teach networking and just about every network CLI out there supports them but I've met very few people who knew that ^a would bring them back to the start of line or that ^e would go to end of line. I'd watch them left-arrow for only so long before I'd explode. :)
 

Cougar

Enlightened Member
Joined
Nov 28, 2015
Messages
5,415
Reaction score
3,144
Location
North Idaho
Guild Total
5
I know you guys are out there, lol! I'm on a Mac and did switch over to textedit. When I want to look at the page, I just manually change the extension from .txt to .html and open it in firefox. Then I've got to change it back to work on the code. Very clunky, but it works.

At least for the time being I bailed out of WordPress. Jeez, I just need a super simple webpage, and my html is just proficient enough for that. (Plus, I've got an old html book.)

If you want to get real esoteric, about 50 years ago I did some constructing of c-lists in IBM's ATMS -- advanced text management system. Could really kick some documentary butt with that system.
 

chazmo

Super Moderator
Gold Supporting
Joined
Nov 7, 2007
Messages
26,205
Reaction score
7,583
Location
Central Massachusetts
Oh, if you're on a Mac, you can use vi from the command prompt. Then we can start debating tabs versus spaces!
 

GAD

Reverential Morlock
Über-Morlock
Joined
Feb 11, 2009
Messages
23,133
Reaction score
18,807
Location
NJ (The nice part)
Guild Total
112
I know you guys are out there, lol! I'm on a Mac and did switch over to textedit. When I want to look at the page, I just manually change the extension from .txt to .html and open it in firefox. Then I've got to change it back to work on the code. Very clunky, but it works.

At least for the time being I bailed out of WordPress. Jeez, I just need a super simple webpage, and my html is just proficient enough for that. (Plus, I've got an old html book.)

If you want to get real esoteric, about 50 years ago I did some constructing of c-lists in IBM's ATMS -- advanced text management system. Could really kick some documentary butt with that system.

There is no reason I can think of that you need to change the extension of a file to edit it unless you’re double-clicking on it and wanting to have the editor open it. You should be able to right click and “open with” on your mac and then just choose text edit.
 

Cougar

Enlightened Member
Joined
Nov 28, 2015
Messages
5,415
Reaction score
3,144
Location
North Idaho
Guild Total
5
You should be able to right click and “open with” on your mac and then just choose text edit.
It should, but nope. It opened the webpage in textedit, not the code. 😕
 

GAD

Reverential Morlock
Über-Morlock
Joined
Feb 11, 2009
Messages
23,133
Reaction score
18,807
Location
NJ (The nice part)
Guild Total
112
It should, but nope. It opened the webpage in textedit, not the code. 😕

Wow - I just tried that and you're right! Textedit seems to have some sort of link to safari built in. Today I learned! Here's how to fix that:

Open Text edit, or any text file, then open preferences (Either TextEdit, Preferences or just use Command-, [Command and comma keys]). Click on the Open and Save tab and then click the box that says "Display HTML files as HTML code instead of formatted text":


Screen Shot 2024-01-29 at 7.07.03 PM copy.jpg

Close the preferences window and now when you "open as" using textedit you'll get the code.
 
Top