Performance: Absolute vs. Relative URLs

后端 未结 5 521
感动是毒
感动是毒 2021-01-12 05:15

What\'s faster? Hot linking (inline linking) to an absolute URI or hosting the resource yourself and using a relative URI?

In his tutorial on how to style HTML5 elem

5条回答
  •  佛祖请我去吃肉
    2021-01-12 05:53

    The time the client needs to resolve the relative URI is absolutely negligible.

    So it doesn’t make any difference whether you link to a resource in the same domain of the document using absolute or relative URIs.

    The only difference will be when the resource is hosted on a different server. Then you’ll need an additional TCP connection to that server whereas an additional HTTP request to a server that you already have a connection to could use that connection.

提交回复
热议问题