Let's say I want to link to a parent directory (
http://example.com/library/) from a subdirectory (
The link to the parent directory can be:
Is there a speed difference based on which way I write the link? I'm not asking about the website loading speed, but if there is a noticeable difference while traversing to the directory.
HTML/CSS relative based paths will always be faster for server speed, this is because the server has less code to send. Relative paths in HTML or CSS form are translated by the end-user's browser and not the server.
So technically, its faster for the server and slower for the end-user, but the end-user would never notice the difference, since the processing required is less than nano-seconds, therefore end users are far more likely to see the difference from relative because the server is going to be able to serve them better.
Effect for browser:
Though this looks like a bit of work for web browser, but technically it does not make much of a difference. The browsers are too fast to handle these relative url structure and make a call to application server
Effect for application Server:
None, as it needs to return the requested file (relative/absolute link ultimately maps to a web path)
Effect on page size:
Yes there would be some reduction in size (again not something that would make a huge difference to your page's performance that could be achieved by something like content encoding gzip or minifying resource)
So i think technically the absolute/relative urls dont make much of a difference on page speed / any weightable matrix.
Yes it make huge difference in managing multiple environments like dev, pp, prodpp etc
Example : on your local development you might have dev.example.com on pre production you might have : pp.example.com . .
So in those scenarios it would be relatively easy to manage code with relative urls (though can be managed by environment settings also)