Wget with URL that contains #

wget is working fine. The URI syntax specifies that the fragment – the #foo part – is to be interpreted entirely client-side, and not used when retrieving the document itself.

For example, if it's a HTML page, the browser might scroll down to a named section, or – in your case – trigger some JavaScript code that shows a particular photo.

In other words, as far as wget is concerned, the URIs

  • http://www.somesite.com/restaurants.html#photo=22x00085 and
  • http://www.somesite.com/restaurants.html

...point to the same page /restaurants.html. It's up to your browser to do the rest. Opening restaurants.html#photo=22x00085 in the browser should work fine.


Without visiting the proper link, I can't tell which one it is, but there are only two options:

  • The hash actually forms part of the requested document's name. In this case, you can encode it:

    http://www.somesite.com/restaurants.html%23photo=22x00085

  • In the other case, under normal circumstances, http://www.somesite.com/restaurants.html and http://www.somesite.com/restaurants.html#photo=22x00085 should point to the same page. The portion after the hash simply indicates the anchor the browser should scroll to after loading the page; it doesn't even get sent to the server.

    However, it is possible, that the hash is (ab)used to load a particular photo with JavaScript. Wget can't interpret JavaScript, so there's nothing you can do about it.