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
🌐
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 - Here's a quick guide to do it: Use the Browser's 'Save As' Feature: Easily save pages by accessing the 'Save as' option in your browser menu. Use Inspector Tools: For a more detailed approach, use your browser's inspect tool to save the HTML ...
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>
Discussions

Chrome recognizes all download links as html files - Google Chrome Community
Skip to main content · Google Chrome Help · Sign in · Google Help · Help Center · Community · Google Chrome · Privacy Policy · Terms of Service · Submit feedback · Send feedback on... This help content & information · General Help Center experience · More on support.google.com
🌐 support.google.com
April 10, 2020
Creating / downloading a .html file with a chrome extension
In Node.JS I would just write a .html file to the local disk, but I can't quite figure out how this works in Chrome Extension world. ... Sub-question: Is there any way to tabify the HTML that is being output? More on stackoverflow.com
🌐 stackoverflow.com
Is it possible to download a websites entire code, HTML, CSS and JavaScript files? - Stack Overflow
They'll allow you to scrape a URL ... html/css, etc. Tools like this were invented to view websites while offline, hence the names. However, just keep in mind that these can only download front-end/display facing files, so they can't download back-end scrips, like PHP files, etc. ... In Chrome, go to File ... More on stackoverflow.com
🌐 stackoverflow.com
Can we download a webpage completely with chrome.downloads.download? (Google Chrome Extension)
However, this code only saves the html file. Stylesheets, scripts and images are not be saved. I want to save the webpage completely, as if I save the page with the dialog, selecting Format: Webpage, Complete. I looked into the document but I couldn't find a way. So my question is: how can I download a webpage completely from an extension using the api(s) of Google Chrome... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

How can I save a webpage as PDF instead of HTML in Google Chrome?
To save a webpage as a PDF, first, click the three dots in the top-right corner of Chrome to open the menu. Choose 'Print' or press 'Ctrl+P' on your keyboard. In the print settings window that appears, change the destination to 'Save as PDF.' Customize the page settings if needed, like selecting specific pages or adjusting the layout. Click 'Save,' and you'll be prompted to choose a location on your computer to save the PDF file. This process converts the entire webpage into a static document that captures the layout and content as it appears in your browser.
🌐
winbuzzer.com
winbuzzer.com › home › how to download a html page in chrome with images and everything else
How to Download a HTML Page in Chrome with Images and Everything Else
Can I save a password-protected webpage for offline access in Chrome?
Saving a password-protected webpage in Chrome requires you to access the page first by entering the necessary credentials. Once you've successfully logged in and can view the content, you can save the webpage for offline access using the methods outlined for saving webpages. It's important to note that the saved page will not retain the password protection, meaning anyone with access to the saved files can view the content without needing a password.
🌐
winbuzzer.com
winbuzzer.com › home › how to download a html page in chrome with images and everything else
How to Download a HTML Page in Chrome with Images and Everything Else
Why can't I find the saved webpage file in my Downloads folder?
If the saved webpage file isn't in your Downloads folder, it might be due to a change in the default download location or an interruption during the download process. Check Chrome's settings to verify the current download location. Additionally, ensure that the saving process was completed successfully without errors. If the file was accidentally saved to a different location, you can use the search function on your device to locate it by name.
🌐
winbuzzer.com
winbuzzer.com › home › how to download a html page in chrome with images and everything else
How to Download a HTML Page in Chrome with Images and Everything Else
🌐
WinBuzzer
winbuzzer.com › home › how to download a html page in chrome with images and everything else
How to Download a HTML Page in Chrome with Images and Everything Else
November 7, 2024 - Typically has the closest results to the original page. When you’ve decided which is right for you, click it and then press the “Save” button. Verify the Download A dialog will appear at the bottom of your Chrome window with the HTML file.
🌐
Google Support
support.google.com › chrome › thread › 39288433 › chrome-recognizes-all-download-links-as-html-files
Chrome recognizes all download links as html files - Google Chrome Community
April 10, 2020 - Skip to main content · Google Chrome Help · Sign in · Google Help · Help Center · Community · Google Chrome · Privacy Policy · Terms of Service · Submit feedback · Send feedback on... This help content & information · General Help Center experience ·
Find elsewhere
🌐
Chrome Web Store
chromewebstore.google.com › detail › save-page-we › dhhpefjklgkmgeafimnjhojgjamoafof
Save Page WE - Chrome Web Store
After saving a page, a download item will appear in the download bar at the bottom of the browser window. Click on the arrow in the download item and enable or disable the 'Always open files of this type' option.
Top answer
1 of 1
1

Here's a method I wrote that leverages HTML5's download attribute to download a file:

var saveHTML = function(fileName, html){
    //  Escape HTML

    var el = document.createElement("dummy");
    el.innerText = html;

    var escapedHTML = el.innerHTML;

    //  Use dummy <a /> tag to save

    var link = document.createElement("a");
    link.download = fileName;
    link.href = "data:text/plain,"+escapedHTML;

    link.click(); // trigger click/download
};

saveHTML("myHTML.html", "<html></html>");

Check it out in action here.

If you're not looking to save the file, you can just use storage.

EDIT:

As @Xan pointed out below, the chrome.downloads API exists as well which may be of some use, specifically chrome.downloads.download() method.


As for multiline strings with tabs/spaces/newlines, there's 3 ways:

1.) Manually, using newlines (\n) and tabs (\t)

"<body>\n\t<section>\n\t\t<h1>Here is some HTML text</h1>\n\t</section>\n\t<div>\n\t\t<p>Here's some more</p>\n\t</div>\n</body>"

Which comes out to:

<body>
    <section>
        <h1>Here is some HTML text</h1>
    </section>
    <div>
        <p>Here's some more</p>
    </div>
</body>

2.) Using JavaScript's multi-line string support, which requires that you insert a backslash at the end of a line:

var html = "<body>\
    <section>\
        <h1>Here is some HTML text</h1>\
    </section>\
    <div>\
        <p>Here's some more</p>\
    </div>\
</body>";

3.) Array.join:

var html = [
    "<body>",
    "   <section>",
    "       <h1>Here is some HTML text</h1>",
    "   </section>",
    "   <div>",
    "       <p>Here's some more</p>",
    "   </div>",
    "</body>"
].join("\n");
🌐
PCMAG
pcmag.com › home › how-to › system utilities › browsers
How to Download a Web Page or Article to Read Offline | PCMag
October 9, 2021 - Open the three-dot menu on the top right and select More Tools > Save page as. You can also right-click anywhere on the page and select Save as or use the keyboard shortcut Ctrl + S in Windows or Command + S in macOS.
🌐
MakeUseOf
makeuseof.com › home › internet › how to download a complete webpage for offline reading: 5 methods
How to Download a Complete Webpage for Offline Reading: 5 Methods
September 17, 2024 - You can simplify the process even further with an extension called Save Page WE, which works on Google Chrome as well as Firefox. Once installed, just click on the extension icon from the toolbar to instantly download a web page to a single HTML file (along with all assets included, like images, ads, and formatting).
Top answer
1 of 2
10

The downloads API downloads a single resource only. If you want to save a complete web page, then you can first open the web page, then export it as MHTML using chrome.pageCapture.saveAsMHTML, create a blob:-URL for the exported Blob using URL.createObjectURL and finally save this URL using the chrome.downloads.download API.

The pageCapture API requires a valid tabId. For instance:

// Create new tab, wait until it is loaded and save the page
chrome.tabs.create({
    url: 'http://example.com'
}, function(tab) {
    chrome.tabs.onUpdated.addListener(function func(tabId, changeInfo) {
        if (tabId == tab.id && changeInfo.status == 'complete') {
            chrome.tabs.onUpdated.removeListener(func);
            savePage(tabId);
        }
    });
});

function savePage(tabId) {
    chrome.pageCapture.saveAsMHTML({
        tabId: tabId
    }, function(blob) {
        var url = URL.createObjectURL(blob);
        // Optional: chrome.tabs.remove(tabId); // to close the tab
        chrome.downloads.download({
            url: url,
            filename: 'whatever.mhtml'
        });
    });
}

To try out, put the previous code in background.js,
add the permissions to manifest.json (as shown below) and reload the extension. Then example.com will be opened, and the web page will be saved as a self-contained MHTML file.

{
    "name": "Save full web page",
    "version": "1",
    "manifest_version": 2,
    "background": {
        "scripts": ["background.js"]
    },
    "permissions": [
        "pageCapture",
        "downloads"
    ]
}
2 of 2
-1

No, it does not download for you all files: images, js, css etc. You should use tools like HTTRACK.

🌐
Chrome Web Store
chromewebstore.google.com › detail › web-page-downloader › aeojmgngnebhbjpncamiplkimkbnmpmk
Web Page Downloader - Chrome Web Store
January 4, 2026 - Researchers & Students - Archive ... to save 2. Choose your options - Select what to download (HTML, images, CSS, etc.) 3. Click "Start Download" - Watch the progress in real-time 4. Access your archive - Find the ZIP file or single HTML file ...
🌐
Html-tuts
html-tuts.com › how-to-download-html-code-from-a-website
The 2 Best Ways to Download HTML Code from a Website
December 14, 2022 - Right-click on the index file. In Chrome Devtools, the “Save as type” shows it is an HTML document. If the browser does not detect an HTML document, use the *.html file extension.
🌐
How-To Geek
howtogeek.com › home › web › how to save a web page in chrome
How to Save a Web Page in Chrome
May 21, 2019 - Choose a folder to save the page and then, from the drop-down menu, choose either "Webpage, HTML only" or "Webpage, Complete." The former keeps only content vital to access it later on (text and formatting), while the latter saves everything (text, images, and additional resource files). If you want to be able to access the full page offline, choose the "complete" option. The web page is downloaded the same as any other file, with its progress at the bottom of Chrome's window.
🌐
Google Support
support.google.com › chrome › answer › 7343019
Read pages later & offline - Computer - Google Chrome Help
You can save web pages to read later or when you're offline. To read pages later offline, download them in Chrome ahead of time. Read a page later To read a page later, add it to your readin
🌐
Reddit
reddit.com › r/learnprogramming › how do i download html as it looks in my browser?
r/learnprogramming on Reddit: How do I download HTML as it looks in my browser?
November 26, 2022 -

Heya!

So I have a problem. I'd like to download episodes from the official Pokémon TV website, https://watch.pokemon.com Thing is, I want episodes in a specific language, let's say https://watch.pokemon.com/sv-se/#/season?id=pokemon-black-white. Now, I could just look at the HTML code by inspecting the source code and manually copy the URL for each episode, and download the episodes with youtube-dlp. But that is a lot of work, as I'd have to do that for each individual episode, and for each season I want. So what I want is to write a script (let's say, Python). I'd like to grab each link (href) from each <a> element of the class "btn-play" (or id "play_btn_reference").

The problem is that when I try to do this with beautifulsoup and requests, all I get is nothing; if you choose "View page source" in your browser while on the site, you'll see what I mean (the . I read on a StackOverflow post that selenium would help with scraping the HTML as-is, but I couldn't exactly get it to work.

This is what I have tried thus far:

from bs4 import BeautifulSoup 
from selenium import webdriver

browser = webdriver.Chrome()

url = "some_page" browser.get(url)

html_source = browser.page_source 

soup = BeautifulSoup(html_source, 'lxml') 

browser.quit()

fname="results.txt" with open(fname, "w", encoding="utf-8") as output: 

output.write(soup.prettify()) output.close()

Any of you fine chaps know how I could move forward? I'd just prefer to not have to manually download each episode, and though I have a little bit of experience with this, I don't know how to get past this hurdle. Any help is much appreciated!

Edit: poor formatting of the post

🌐
Chrome Web Store
chromewebstore.google.com › detail › singlefile › mpiodijhokgodhhofbcjdecpffjipkle
SingleFile - Chrome Web Store
Follows recommended practices for Chrome extensions. Learn more.Featured4.4( ... Ratings are updated daily and may not reflect the most recent reviews. ... SingleFile is an extension that helps you to save a complete page (with CSS, images, fonts, frames, etc.) as a single HTML file. Getting started - Wait until the page is fully loaded. - Click on the SingleFile button in ...
🌐
Chrome Web Store
chromewebstore.google.com › detail › 下载网页所有资源 › hdeapggikfpgpojodegljabgkemcbflb
DownloadPage(All resources,html+css+js+images) - Chrome Web Store
Download all resources of the web page, including HTML, CSS, JavaScript and images. Download all resources according to the…