When you choose "Save As", just type "filename.html" manually. It should save it as an html file that your default browser will load. The file's icon should become that of your default browser (i.e. Chrome or Edge).
This not only works for Notepad, but also new blank files you create inside your working folder when using code editors such as VS Code, Sublime Text, Atom... etc.
Answer from Haley A on Stack Overflowhtml - I am coding in Notepad but I cannot save because there is no file extension" (*.*)" after " All Files" - Stack Overflow
Chrome to save HTML content - Stack Overflow
Saving a plain text file as HTML document.
microsoft edge - Can't get my .html files to save in chrome - Stack Overflow
How to Save as an HTML File in Notepad?
How to save HTML Code in Notepad?
How to Make an HTML File in Notepad?
Videos
When you choose "Save As", just type "filename.html" manually. It should save it as an html file that your default browser will load. The file's icon should become that of your default browser (i.e. Chrome or Edge).
This not only works for Notepad, but also new blank files you create inside your working folder when using code editors such as VS Code, Sublime Text, Atom... etc.
In both cases, you have to type the name of the file and the file format. With notepad the only default formats are all for text. After you save the file and open it, the default application for opening '.html' files will launch.
As for the (.*) after "All files", my notepad does not show the suffix either. It works the same anyway
Back when I used to use MS Windows' Notepad, my primary use of that program, in addition to creating plain text files to store info, was to create lists of active links by writing in basic HTML language on a text file, and saving as an HTML document, in addition to also saving the original source code as a plain text file.
In Notepad++ I couldn't do this. If I saved a text file as an HTML document, it would alter my plain text file (but not turn it into the web page type document I wanted) and then refuse to save changes giving me an error message that "You already have this document opened."
After much head-banging I finally realized that, unlike MS Notepad, Notepad++ does not allow two documents to be opened at the same time, and that was the crux of the problem. (The fact that MS Notepad allows multiple documents to be opened at one time is perhaps the only attribute to recommend it.)
Probably everyone else (more techy than I) knows this, but just in case some other lost soul is struggling with it, this is the way:
Instead of opening a plain text document that you wish to save as an html doc, right click on it and select "edit." Then make changes (if needed) to the plain text document and click "Save." Next "File" - "Save as" and in "File Name" enter name with dot html extension. In "Save as Type" select "All Files." Click "Save."
Using "Edit" to save plain text documents as html documents solved all my problems. I've learned that Notepad++ really doesn't like 2 documents open at once. So from now on, I'll respect that!
The simplest thing I can think of is to open the file you want to save as source code, which you can do from Chrome Android by prepending view-source to the URL, like so.
view-source:https://my-site.tld/xxx/my_page.html
You can then either copy and paste this code into a local file, or use the share button to open it with a compatible app of your choosing.
If this seems like too much of a pain, you might consider doing something like using PHP to determine whether the file should be viewed or downloaded. For example if the IP address of the request matches your phone, download instead of displaying the file.
<?php
/**
* File url: https://my-site.tld/xxx/my_page.php
*
*/
$remote_address = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_SANITIZE_STRING);
if ($remote_address === '56.57.58.59') {
header("Content-Disposition: attachment; filename=\"filename.html\"\n");
header("Content-Type: text/html\n");
}
?>
<!-- Begin actual page content -->
<!DOCTYPE html>
<html lang="en-US">
<meta charset="UTF-8">
....
Conversely, you could also simply create a separate page to allow a download regardless of the requesting IP address.
<?php
/**
* File url: https://my-site.tld/xxx/my_page-download.php
*
*/
header("Content-Disposition: attachment; filename=\"filename.html\"\n");
header("Content-Type: text/html\n");
readfile('path/to/file');
Additional information about the Content-Disposition header may be found in the Mozilla Developer Docs. It's not the only resource, of course, it's just my personal favorite.
You can copy the html raw content (from view-source) into the textarea on this page
https://jsfiddle.net/o19q5tzy
and press download.
The webpage only contains
<a id="link" href="" download='tmp.html'>download</a><br>
<textarea oninput="link.href = window.URL.createObjectURL(new Blob([this.value], {type: 'plain/text'}))" style="width: 100ch; height: 40ch"></textarea>
Currently, when I open my saved notepad (normally saved under '.txt'), it views in browser. Is there a way to open the file in my local notepad (using windows)? I want to edit the file, not just view it. TIA!