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.

Answer from Jose Fernando Lopez Fernandez on Stack Exchange
Top answer
1 of 2
4

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.

2 of 2
0

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>
🌐
Reddit
reddit.com › r/androidquestions › open a local html file on a phone?
r/AndroidQuestions on Reddit: Open a local HTML file on a phone?
September 9, 2024 -

I considered it a no-brainer. I was wrong.

I wanted to take along some files to read when I'm out of network reach or in flight mode. The files happen to be quite plain HTML files, no script, just a CSS file defining the simple layout, and that's it. So I copied the HTML and the CSS files onto my phone and tried to open them.

First attempt was from a file manager. It told me that it no idea what to do with an HTML file. I then tried to look for an "open file" entry in Chrome. Nope. Same in Firefox. Then I tried to force-open the files by using a file:///path/to/file style URL - and it actually submitted the whole string to Google as a search string, as if Chrome (and Firefox) had been lobotomized of the file: protocol.

Now I'm at a loss - is there no way to open a simple HTML file on an Android 13 phone?

🌐
Cantech
cantech.in › home › how to save html file in chrome, notepad, desktop & mobile
How to Save HTML File in Chrome, Notepad, Desktop & Mobile
October 30, 2025 - Then, choose the location to save the file or create a folder in your preferred directory, name the file, and then click on the ‘Save’ button. ... Install the extension and click on its icon when you are on the web page that you would like to save. It will prompt you to download the rendered HTML.
🌐
Google Play
play.google.com › store › apps › details
HTML Viewer - Apps on Google Play
📂 Open Local HTML Files: Directly open HTML files stored on your device. 🌐 Webpage Preview: Browse the web and view the website’s live version. 🔍 Text Search Functionality: Find and search specific text within the HTML code. 📱 QR Code Scanning: Scan QR codes to instantly retrieve and view the HTML source code of the corresponding URLs. 📜 Browsing History: Keep track of your viewed pages for easy reference. 💻 Mobile and Desktop Site Options: Choose to view the mobile or desktop version of websites.
Rating: 3.4 ​ - ​ 7.92K votes
Top answer
1 of 2
1

Essentially, what you'll need to do (and what my app mentioned below does) is go over all the references links to additional additional assets / images / scripts and so on, download them, and then change the HTML document to point to the local downloaded copy. Something like this, with Jsoup:

  • Find all the img elements on the page,

  • Get the location / url of the image file from the src attribute of the img elements (with .attr("abs:src:)),

  • Download all of those images to a local directory

  • Change each of the image elements src attribute values to point to the location of the downloaded image file, relative to where the main HTML file will be stored, eg with .attr("src", "assets/imagefilename.png"").

  • Do this for all other assets required by the page, eg. images, CSS, scripts, html5 video, and others. I also did some regex on the CSS (both linked and inline) to extract, download, and rewrite things like background image references and in the css. Webpages also have other linked things like favicons or RSS feeds which you might want too.

  • Save your Jsoup document (with the modified URLs pointing to your downloaded versions of the assets) to file, by calling .toString() on it and saving the result to a file.

You can then open the local HTML file in webview, and, assuming you have done everything right, it will show with all images and assets, even offline.


I actually wrote an Android app which does exactly this: save a complete HTML file and all of the CSS / images / other assets to a local file / directory, using Jsoup.

See https://github.com/JonasCz/SaveForOffline/ for the source, specifically SaveService.java for the actual HTML page saving / downloading code.

Beware that it's GPL licensed, so you have to comply with the GPL license if you use (parts of) it.

Also beware that it does a lot of things, and is quite messy as a result, (there's also no comments or documentation either...) but it may help you.

2 of 2
0

You can do it with Jsoup. IMO, it's a lot of work. On the other, you can consider Crawler4j.

There is a tutorial on their website. Have look to the example for crawling images.

🌐
Quora
quora.com › How-can-I-download-the-HTML-code-of-a-website-on-an-Android-app-I-am-working-on
How to download the HTML code of a website on an Android app I am working on - Quora
Answer (1 of 2): Use HttpClient to fetch the HTML markup as if you were a browser. Basically create an instance of HttpGet with the URL as the parameter to the constructor. Then create a DefaultHttpClient and execute it with the get instance.
Find elsewhere
🌐
ConTEXT Editor
contexteditor.org › home › news › how to open html file in mobile
How to open HTML file in mobile
September 3, 2023 - 5. Clear Cache & Cookies: Clearing ... phone? You can open an HTML file on your mobile phone by downloading a web browser app such as Google Chrome, Firefox, or Safari....
🌐
Gadgetroyale
gadgetroyale.com › home › how to open html file in mobile browser (a how-to guide)
How to open html file in mobile browser (A How-to Guide) - Gadgetroyale
November 30, 2023 - Don’t miss > What apps need to run in the background · If you have a html file on your mobile phone, you can import or load the html file using this HTML Viewer & HTML Reader: HTML Source Code Viewer app for android.
🌐
Stack Exchange
android.stackexchange.com › questions › 184320 › downloading-an-html-page
Downloading an HTML page - Android Enthusiasts Stack Exchange
Connect and share knowledge within a single location that is structured and easy to search. Learn more about Teams ... I usually make a copy in PDF format but sometimes it does not get very good.
🌐
daily.dev
daily.dev › home › blog › get into tech › download html page: step-by-step guide
Download HTML Page: Step-by-Step Guide
December 22, 2025 - Learn how to download HTML pages step-by-step, including using browser features, inspector tools, and editing files with Visual Studio Code. Troubleshoot common issues and explore additional resources.
🌐
Reddit
reddit.com › r/html › how to download all links inside an html file?
r/HTML on Reddit: How to download all links inside an HTML file?
November 22, 2022 -

So I am currently trying to download all of my memories from my Snapchat account. My main reason is my dog is ill and may not be around longer, so I want to get the videos of her off of it for safe keeping.

I requested my Snapchat data and they sent an HTML file with a download link for every memory. I managed to get each link on its own line in a .txt file. I tried using Python to extract each link from the text file to a table and download every file automatically, so I wouldn't have to click download 1,000+ times. However, when the link is opened, it shows "Error: HTTP method GET is not supported by this URL".

I have no experience with HTML, JS, or any web development, only Lua and Java. Is there a tool already in existence I could use to download from every link? I know this question may be a bit unconventional, so I appreciate any help.

Thank you.

🌐
Reddit
reddit.com › r/html › how can i download html?
r/HTML on Reddit: How can I download HTML?
August 8, 2020 -

How can I download HTML?

Hello! I just finished the HTML and css course on codecademy and want to start writing it on my own now. I have been trying to figure out how to get html on my computer and based off what I found online I used notepad to write my code, but I don’t like how it doesn’t give those error notifications. I also used sublime text but for some reason it’s not working (probably my code but idk it works with notepad). I’ve done Java and Python before and I’m starting to think getting HTML on my computer probably isn’t the same process as getting java. Do I have to download CSS separately? Ik these are pretty basic questions lol but if someone could help me out with getting html (and maybe CSS 😳) on my computer(windows) I would really appreciate it!

🌐
Tempertemper
tempertemper.net › blog › downloading-a-website-as-html-files
Downloading a website as HTML files – tempertemper
But how do you go about downloading a whole website? Turns out it’s quite easy using Wget. First up, installing Wget. There are lots ways to install it, but I did it with Homebrew with:
🌐
W3Schools
w3schools.com › howto › howto_html_download_link.asp
How To Create a Download Link
There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.). You can also specify a value for the download attribute, which will be the new filename of the downloaded file. If the value is omitted, the original filename is used. Specify a value for the download attribute, which will be the new filename of the downloaded file ("w3logo.jpg" instead of "myw3schoolsimage.jpg"):
🌐
RapidTables
rapidtables.com › web › html › link › html-download-link.html
HTML download link
How to write download link in HTML. Download link is a link that is used to download a file from the server to the browser's directory on the local disk.