I have a small script on artimap.com that I use to asychronously load images. Each images are the same transparent gif, but the rel attribute is the real adress of the image. The javaScript reads the rel attribute and load that image.
I plan to put “http://artimap.com/” before all the images that I load instead of using relative src because that will be easier to manage the files on that multilingual website.
Is there a difference in speed, or server load with using relative src versus absolute src when loading multiples images in a web page ?
I have a small script on artimap.com that I use to asychronously load images.
Share
No, or just a very very minuscule one. Relative URLs are resolved by the client (=browser) relative to the current location (= the loaded page). When the request is made to the server, it is always with the full URL.
The time needed by the browser to determine the current location, and to calculate the relative URL is absolutely negligeable.
You should be safe using relative URLs performance wise, because even if that micro-performance mattered, JavaScript is bound to be slower in calculating the full URL than the browser.