Replace example.com with the website you want to download. This command will download the entire website, including all the elements that compose the page (images, CSS, etc.), and convert the links so that they work locally and offline[1].
Here's a brief explanation of the options used in the command:
--recursive: Download the entire website recursively.
--no-clobber: Don't overwrite existing files.
--page-requisites: Download all the elements required to display the page properly (images, CSS, etc.).
--html-extension: Save files with the .html extension.
--convert-links: Convert links so that they work locally and offline.
--restrict-file-names=windows: Modify filenames so that they work in Windows as well.
--domains example.com: Don't follow links outside the specified domain.
--no-parent: Don't follow links outside the specified directory.
If the website uses external resources like jQuery, you can try using the --span-hosts option to download resources from other domains as well:
However, this may also download additional content from other domains that you might not need. To avoid downloading unnecessary content, you can manually download the required resources (like jQuery) and update the HTML files to use the local copies instead.
Keep in mind that some websites may have measures in place to prevent downloading their content using tools like wget. In such cases, you may need to adjust the command options or use alternative methods to download the website for offline browsing[6].
--mirror – Makes (among other things) the download recursive.
--convert-links – convert all the links (also to stuff like CSS stylesheets) to relative, so it will be suitable for offline viewing.
--adjust-extension – Adds suitable extensions to filenames (html or css) depending on their content-type.
--page-requisites – Download things like CSS style-sheets and images required to properly display the page offline.
--no-parent – When recursing do not ascend to the parent directory. It useful for restricting the download to only a portion of the site.
–m (--mirror) : turn on options suitable for mirroring (infinite recursive download and timestamps).
-p (--page-requisites) : download all files that are necessary to properly display a given HTML page. This includes such things as inlined images, sounds, and referenced stylesheets.
-H (--span-hosts): enable spanning across hosts when doing recursive retrieving.
–k (--convert-links) : after the download, convert the links in document for local viewing.
-K (--backup-converted) : when converting a file, back up the original version with a .orig suffix. Affects the behavior of -N.
-E (--adjust-extension) : add the proper extension to the end of the file.
-b (--background) : go to background immediately after startup. If no output file is specified via the -o, output is redirected to wget-log.
-e (--execute) : execute command (robots=off).
-t number (--tries=number) : set number of tries to number.
-U (--user-agent) : identify as agent-string to the HTTP server. Some servers may ban you permanently for recursively download if you send the default User Agent.