I've downloaded and stored an index.htm page, and (depending on some criteria of this page) want to use wget to fetch all images, javascripts, css-files etc. a browser would download when displaying the page.

I currently use:

wget --server-response --timeout=120 --base="http://www.example.com/" --force-html --input-file="index.htm"

This works so far but it fetches as well all links defined like a href="/somesubpage.htm". How can I avoid downloading the a href...?


Since wget does not know how to execute javascript you have only 2 solutions :

  • Make a request one the page with your browser and look at webserver logs. Then use wget on each one of the web page element.
  • Use phantomjs..
  • Thanks for your reply. The problem is not executing javascript, I just want to download the javascript. The problem is that wget fetches all links as well which I don't want to (because there are a lot and I want to save bandwidth). – Werner Dec 26 '12 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.