Skip to main content

Downloading a Website Using Chrome Headless via Command Line

Updated by Tim Rabbetts on
Downloading a Website Using Chrome Headless via Command Line

Downloading a Website Using Chrome Headless via Command Line

Downloading a website using Chrome Headless via command line is a convenient way to retrieve the contents of a website for offline browsing or archiving purposes. Chrome Headless is a mode of Google Chrome that runs without a graphical user interface, making it ideal for automation tasks and scripting.

To download a website using Chrome Headless via command line, you can use the following steps:

  1. Open your terminal or command prompt.
  2. Navigate to the directory where you want to save the downloaded website.
  3. Run the following command:
chrome --headless --disable-gpu --screenshot https://www.example.com/

This command will launch Chrome in Headless mode, disable the GPU to save resources, and take a screenshot of the specified URL. The screenshot will be saved in the current directory with a filename like "screenshot.png".

If you want to download the entire website instead of just a screenshot, you can use a tool like HTTrack or Node Website Scraper. These tools allow you to recursively download all the assets of a website, including HTML, CSS, JavaScript, images, and other files.

Downloading a website using Chrome Headless via command line is a powerful tool for web developers, researchers, and anyone who needs to access a website offline. By following the steps outlined above, you can quickly and easily retrieve the contents of any website for your own use.