How to get a perfect local copy of a web page?

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.


Solution 1:

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.

Solution 2:

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.

Solution 3:

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.