Absolute vs relative URLs

后端 未结 12 1382
时光取名叫无心
时光取名叫无心 2020-11-21 05:31

I would like to know the differences between these two types of URLs: relative URLs (for pictures, CSS files, JS files, etc.) and absolute URLs.

In addition, which o

12条回答
  •  爱一瞬间的悲伤
    2020-11-21 05:43

    A URL that starts with the URL scheme and scheme specific part (http://, https://, ftp://, etc.) is an absolute URL.

    Any other URL is a relative URL and needs a base URL the relative URL is resolved from (and thus depend on) that is the URL of the resource the reference is used in if not declared otherwise.

    Take a look at RFC 2396 – Appendix C for examples of resolving relative URLs.

提交回复
热议问题