绝对 URL(完全限定?)的定义是什么? [英] What is the definition of an absolute URL (fully qualified?)

查看:31
本文介绍了绝对 URL(完全限定?)的定义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有(至少)三种方式可以链接到资源:

  1. href="foo/bar.html"
  2. href="/foo/bar.html"
  3. href="http://example.com/foo/bar.html"

第一个是相对网址",没问题.但我已经看到 (2) 和 (3) 都被称为绝对网址".哪个被正确地称为绝对网址",另一个的正确名称是什么?

(参考相关标准或其他官方文档的奖励积分.)

解决方案

RFC 3986 定义了统一资源标识符.

<块引用>

以单个斜杠字符开头的相对引用是
称为绝对路径引用.一个相对引用
不以斜杠字符开头的称为相对路径引用.

  1. href="foo/bar.html" 是相对引用,特别是相对路径引用.
  2. href="/foo/bar.html"相对引用,带有 绝对路径
  3. href="http://example.com/foo/bar.html" 是一个 绝对 URI
  4. href="//example.com/foo/bar.html" 是一个网络路径引用

<块引用>

以两个斜杠字符开头的相对引用称为网络路径引用;此类引用很少使用.

There are (at least) three ways to link to a resource:

  1. href="foo/bar.html"
  2. href="/foo/bar.html"
  3. href="http://example.com/foo/bar.html"

The first is a "relative url", no problem. But I've seen (2) and (3) both referred to as an "absolute url". Which is correctly termed an "absolute url", and what is the proper name of the other?

(Bonus points for references to relevant standards or other official documentation.)

解决方案

RFC 3986 defines Uniform Resource Identifiers.

A relative reference that begins with a single slash character is
termed an absolute-path reference. A relative reference that does
not begin with a slash character is termed a relative-path reference.

  1. href="foo/bar.html" is a relative reference, specifically a relative-path reference.
  2. href="/foo/bar.html" is a relative reference with an absolute path
  3. href="http://example.com/foo/bar.html" is an absolute URI
  4. href="//example.com/foo/bar.html" is a network-path reference

A relative reference that begins with two slash characters is termed a network-path reference; such references are rarely used.

这篇关于绝对 URL(完全限定?)的定义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆