问题原文
原帖链接 · Jakub Kliský · CC BY-SA 3.0
Let's say I want to link to a parent directory (http://example.com/library/) from a subdirectory (http://example.com/library/html/basics/).
The link to the parent directory can be:
href="../../"href="/library/"href="http://example.com/library/"
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.
已采纳解答
原帖链接 · abhinsit · CC BY-SA 3.0
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)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
