title: URL: following rules for relative path with trailing slash
body: <p>I've found lots of answers on the server side for the relative-path-with-trailing-slash question, but none on the client side. Help me out here.</p>
  
  <p>I'm writing a web crawler to take statistics on a set of websites, and am running into a problem. One website I'm working with has a navbar with relative paths with trailing slashes, and intends those paths to be treated as absolute, like so:</p>
  
  <p>on page <code>http://www.example.com/foo/bar</code></p>
  
  <p>navbar links addresses -> <code>foo/</code>, <code>baz/</code>, <code>quox/</code></p>
  
  <p>intended absolute urls -> <code>http://www.example.com/foo/</code>, <code>http://www.example.com/baz/</code>, <code>http://www.example.com/quox/</code></p>
  
  <p>The problem is, as far as I can tell, this is nonstandard behavior - and yet Firefox and Chrome both handle those paths as absolute. According to <a href="http://www.ietf.org/rfc/rfc1808.txt" rel="nofollow">RFC 1808</a>, and <a href="http://www.ietf.org/rfc/rfc2396.txt" rel="nofollow">RFC 2396</a>, these should be handled like relative paths, like this:</p>
  
  <p>spec-correct absolute urls -> <code>http://www.example.com/foo/foo/</code>, <code>http://www.example.com/foo/baz/</code>, <code>http://www.example.com/foo/quox/</code></p>
  
  <p>In particular at section 5.1 in RFC 1808 and C.1 in RFC 2396, the 4th example shows this case specifically being treated as a relative path. In Ruby, which I'm writing the crawler in, the <a href="http://addressable.rubyforge.org/" rel="nofollow">Addressable gem</a> handles these according to spec.</p>
  
  <p>What's worse is the server in question is happy to return 200 OK for these paths, and all of them have this navbar: so I end up crawling <code>http://www.example.com/foo/</code> which is the same page as <code>http://www.example.com/foo/foo/</code>, <code>http://www.example.com/foo/foo/foo/</code> and so on, combinatorially to bizarre URLs like <code>http://www.example.com/foo/baz/quox/foo/</code></p>
  
  <p>So here's the question: Am I missing something that allows Chrome and Firefox to both interpret these urls as absolute paths? Is there any way to disambiguate the case where the spec is correct and the absolute path is what is intended?</p>