How to save an HTML page from a web site using Chrome I have a web site that has some simple HTML pages with no images, no external CSS or JavaScript references. So the whole HTML page is a single self-containing file that has HTML code, together with inline CSS and JavaScript code. In other words, once I copy the HTML file into my Downloads folder on my mobile device, I can use it (while being offline) by loading the following into the Chrome browser:
file:///storage/emulated/0/Download/my_page.html
The problem is that I cannot download the web page from my web site into the Downloads folder using Chrome on my mobile device: When I go to:
https://my-site.tld/xxx/my_page.html
and display the page in the mobile browser, I can use the download (⭳) button on Chrome browser's tab; however it creates an .mthml file instead, with a name like this:
Title of My Page.mhtml
When I try to open this file while my mobile device is offline, none of the interactive content on the page (e.g., buttons, input boxes, etc.) is enabled. Note that my page contains interactive content that is processed locally by JavaScript contained in the page.
Currently, the only solution is to connect my mobile device to my PC (using USB for example) and copy the .html file from my PC to the mobile's Downloads file. Once I copy the .html file and open it on my mobile device using the file:///... URL as given above, the page's JavaScript works as expected (contrary to the .mhtml version).
Assuming that the .html page on my-site is updated frequently, it is tedious to download it to PC and copy over my mobile phone when I need an update. There must be a more direct way.
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.
&lt;?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(&quot;Content-Disposition: attachment; filename=\&quot;filename.html\&quot;\n&quot;);
    header(&quot;Content-Type: text/html\n&quot;);
}

?&gt;
&lt;!-- Begin actual page content --&gt;
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en-US&quot;&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    ....

Conversely, you could also simply create a separate page to allow a download regardless of the requesting IP address.
&lt;?php
/**
 * File url: https://my-site.tld/xxx/my_page-download.php
 *
 */

header(&quot;Content-Disposition: attachment; filename=\&quot;filename.html\&quot;\n&quot;);
header(&quot;Content-Type: text/html\n&quot;);
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.