Strange relative links
Posted: Fri May 07, 2010 6:34 pm
i have a question about how relative links work
i went to a particular website and saw that i was 2 subdirectories deep, that is i was at www.blabla.com/bla/bla/page
then i looked at the source code of the page and saw that the source of an image was src='/images/soso.png'
so one would expect that the full address of this image was
www.blabla.com/bla/bla/images/soso.png
but it wasn't!!! it was at
www.blabla.com/images/soso.png
this is not how these links usually work.
somehow, the browser knew to use the root directory, instead of the current subdirectory of the page. how did it know?
i went to a particular website and saw that i was 2 subdirectories deep, that is i was at www.blabla.com/bla/bla/page
then i looked at the source code of the page and saw that the source of an image was src='/images/soso.png'
so one would expect that the full address of this image was
www.blabla.com/bla/bla/images/soso.png
but it wasn't!!! it was at
www.blabla.com/images/soso.png
this is not how these links usually work.
somehow, the browser knew to use the root directory, instead of the current subdirectory of the page. how did it know?