No matter what browser I've tried (even Chrome), when saving a web page as local files, it's never quite exact. Lots of JavaScript & such seems to trip it up. I'm looking for some way to get a 100% perfect local copy of a web page. In other words, all CSS/images/JavaScripts should pull down as well AND the HTML references to said content should be changed to point to a local folder. Is there a way to do this? I'm primarily on a Mac but I have access to Linux.
5 Answers
The reason "Lots of JavaScript & such seems to trip it up" is probably that so many companies use content management systems (Joomla, Drupal and Wordpress) , which use those to query databases for content. If that is the case, you will not get the whole page like you want. So it depends on the web page.
Try downloading the website using HTTrack. The options allow you to configure how the locally downloaded files will be linked, and what exactly is downloaded. Windows, Linux, and Mac builds are available.
You need to download the entire website with Httrack (you need to set it so it doesn't download external JavaScripts)... just run it, then see the directories which downloaded, run Httrack again and exclude (f.e. -.googlesyndication.com/* -.facebook.net/ -*.google-analytics.com/** etc.)
You can also use Wget:
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent http://www.yourdomain.com
When you are done you still need to rewrite all the links so they don't point at .../index.html. This solves Dynamic to Static HTML Convertor.
On google chrome or firefox, you can use the Save Page WE extension to get a highly accurate copy of a web page (as currently displayed) as a single html file.
Worked perfectly for me where everything else failed.
- Firefox : https://addons.mozilla.org/en-US/firefox/addon/save-page-we/versions/
- Chrome : https://chrome.google.com/webstore/detail/save-page-we/dhhpefjklgkmgeafimnjhojgjamoafof
EDIT: there is also the Single File extension:
- Firefox: https://addons.mozilla.org/en-US/firefox/addon/single-file/
- Chrome: https://chrome.google.com/webstore/detail/singlefile/mpiodijhokgodhhofbcjdecpffjipkle?hl=en
- Microsoft Edge: https://microsoftedge.microsoft.com/addons/detail/singlefile/efnbkdcfmcmnhlkaijjjmhjjgladedno
It even gives you the following options:
- Enable "save to Google Drive" to upload pages to Google Drive.
- Enable "add proof of existence" to prove the existence of saved pages by linking the SHA256 of the pages into the blockchain
If you are on Linux then you might want to give a try to this command.
wget
I offers more flexibility to download from the Internet.
Example:- on terminal type
wget -m "www.example.com"
-m
stands for mirror (of a website). You can also specify depth for downloading a website.