Is it possible to download a websites entire code, HTML, CSS and JavaScript files?

89,343

Solution 1

Hit Ctrl+S and save it as an HTML file (not MHTML). Then, in the <head> tag, add a <base href="http://downloaded_site's_address.com"> tag. For this webpage, for example, it would be <base href="http://stackoverflow.com">.

This makes sure that all relative links point back to where they're supposed to instead of to the folder you saved the HTML file in, so all of the resources (CSS, images, JavaScript, etc.) load correctly instead of leaving you with just HTML. See MDN for more details on the <base> tag.

Solution 2

The HTML, CSS and JavaScript are sent to your computer when you ask for them on a HTTP protocol (for instance, when you enter a url on your browser), therefore, you have these parts and could replicate on your own pc or server. But if the website has a server-side code (databases, some type of authentication, etc), you will not have access to it, and therefore, won't be able to replicate on your own pc/server.

Solution 3

In Chrome, go to File -> Save Page as.

That will download the entire contents of the page.

Solution 4

Sure. There are tools/scrapers for this, such as SurfOffline and A1 Website Download. I've used both. They'll allow you to scrape a URL for all its files, including 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.

Solution 5

You can use HTTrack tools to grab all website content and all the entire image, css, html, javascript.

You can download HTTrack here

Share:
89,343
Admin
Author by

Admin

Updated on September 01, 2020

Comments

  • Admin
    Admin over 3 years

    Is it possible to fully download a website or view all of its code? Like for example I know you can view page source in a browser but is there a way to download all of a websites code like HTML, CSS and JavaScript then run it on my own server or change it up and run that?

  • Makyen
    Makyen over 7 years
    In all of Chrome, Firefox and IE, the keyboard shortcut is Ctrl-s.
  • Sebastian Nielsen
    Sebastian Nielsen over 3 years
    Just tried HTTrack, it sucks: Didn't download all files of the main domain despite there being a lot of links pointing to the files not downloaded.