Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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="" --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...?

share|improve this question

migrated from Dec 26 '12 at 16:34

This question came from our site for professional and enthusiast programmers.

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..
share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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