Is using absolute links on a webpage slow?

Miscellaneous Forums/General Discussion/Is using absolute links on a webpage slow?

Basically normally I have all my paths as relative to the page so for example an image source might be "images/whatever.jpg". However, due to the way I structured some new stuff on my site I really need to have an absolute link like "http://www.greyaliengames.com/images/whatever.jpg".

Is using an absolute link slower for the user as the domain needs to be reslved each time or something?

Anyone know?

Thanks :-)

I think its the same, but I'm not totally sure.

Dont most operating systems cache dns results ?

In other words, it shouldn't make a difference.

First, The domain name will be cached upon first visit. Only hitting Ctrl-F5 will force a re-query of the dns.

Secondly, all relative links are converted by the browser to absolute when they are passed for the page request.

So either way is the same really (in terms of speed)

The webserver will pull local stuff regardless of relative or absolute links.

However, instead of : "http://www.myserver.com/directory/images/img.jpg"

why not use : "/directory/images/img.jpg" - using the pre-slash it does not matter about the root url since HTML/PHP/JavaScript will now reference from the root and not the relative directory.

To go up one level, you can use ../

So to get up one level from the images directory, you can use ../etc.jpg

The problem that you have in using links to pages in your site like is that it makes it much harder to make changes to the structure of your site later on.

OK thanks for the speed info.

Indiepath: OK so a / at the start means root. Useful, thanks!

Game Boy: Thanks, I know that though as I'm a DOS kid ;-)