Relative or Full Path

E

EYEBUZZ

Hi,

When one uses a full path URL for an image (or javascript or whatever)
("http://www.host.com/images/photo1.jpg") versus a relative one
("images/photo1.jpg"):

1) is there any difference in the time it takes to receive the image in the
browser?

2) Any difference in caching the image so it's already loaded on subsequent
pages?...ie does it force the image to fully reload each time?

3) Any reason not to use the full path, other than it adds just that much more
code (hence file size) to an HTML file?

Thanks,
Eye
 
M

Mark Parnell

Hi,
G'day.


When one uses a full path URL for an image (or javascript or whatever)
("http://www.host.com/images/photo1.jpg") versus a relative one
("images/photo1.jpg"):

1) is there any difference in the time it takes to receive the image in the
browser?

I doubt it, except maybe the extra half a micro-millisecond it takes to
parse the extra few bytes in the address. :)
2) Any difference in caching the image so it's already loaded on subsequent
pages?...ie does it force the image to fully reload each time?

Not AFAIK.
3) Any reason not to use the full path, other than it adds just that much more
code (hence file size) to an HTML file?

If you change your domain, you have to change all of the links (easy
enough with a find and replace tool, but better not to have to do it at
all).

Also, when you are testing locally, it will always download the images
from the web, rather than local.

Personally, I use absolute URLs (/images/foo.png) rather than relative
(../../../images/foo.png). I find them much easier to manage. :)
 
L

Leif K-Brooks

EYEBUZZ said:
When one uses a full path URL for an image (or javascript or whatever)
("http://www.host.com/images/photo1.jpg") versus a relative one
("images/photo1.jpg"):

1) is there any difference in the time it takes to receive the image in the
browser?

I suppose there would be some slight difference in processing time, but
I can't imagine it being even slightly noticable.
2) Any difference in caching the image so it's already loaded on subsequent
pages?...ie does it force the image to fully reload each time?

Doubt it.
3) Any reason not to use the full path, other than it adds just that much more
code (hence file size) to an HTML file?

If you change domain names, you'll have to change all of your images later.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top