URL -- Uniform Resource Locator
Containsinformation about how to fetch a resource from its location. For example:
· http://example.com/mypage.html
· ftp://example.com/download.zip
· mailto:user@example.com
· file:///home/user/file.txt
· tel:1-888-555-5555
· http://example.com/resource?foo=bar#fragment
· /other/link.html (Arelative URL, only useful in the context of another URL)
URLs always start with a protocol (http) and usually contain informationsuch as the network host name (example.com)and often a document path (/foo/mypage.html).URLs may have query parameters and fragment identifiers.
URN -- Uniform Resource Name
Identifies a resource by a unique and persistent name. Itusually starts with the prefix urn: Forexample:
· urn:isbn:0451450523 toidentify a book by its ISBN number.
· urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66 aglobally unique identifier
· urn:publishing:book - AnXML namespace that identifies the document as a type of book.
URNs canidentify ideas and concepts. They are not restricted to identifying documents.When a URN does represent a document, it can be translated into a URL by a"resolver". The document can then be downloaded from the URL.
URI -- Uniform Resource Identifier
URIsencompass URLs, URNs, and other ways to identify a resource.
An example of a URI that is neither a URL nor a URN would be a dataURI such as data:,Hello%20World.It is not a URL nor a URN because the URI contains the data. It neither namesit, nor tells you how to locate it over the network.
There are also uniform resource citations (URCs) that point tometa data about a document rather than to the document itself. An example of aURC would be an identifier for viewing the source code of a web page: view-source:http://example.com/.A URC is another type of URI that is neither URL nor URN.
Frequently Asked Questions
I've heard that I shouldn't say URL anymore, why?
The W3 spec for HTML says that the href of an anchor tag can contain a URI, not just a URL. You shouldbe able to put in a URN such as <a href="urn:isbn:0451450523">.Your browser would then resolve that URN to a URL and download the book foryou.
Do any browsers actually know how to fetch documents byURN?
Not that Iknow of, but modern web browser do implement the data URI scheme.
Does the difference between URL and URI have anything todo with whether it is relative or absolute?
No. Bothrelative and absolute URLs are URLs (and URIs.)
Does the difference between URL and URI have anything todo with whether it has query parameters?
No. BothURLs with and without query parameters are URLs (and URIs.)
Does the difference between URL and URI have anything todo with whether it has a fragment identifier?
No. BothURLs with and without fragment identifiers are URLs (and URIs.)
But doesn't the W3C now say that URLs and URIs are thesame thing?
Yes. The W3C realized that there is a ton of confusion aboutthis. They issued a URIclarification document thatsays that it is now OK to use the terms URL and URI interchangeably (to meanURI). It is no longer useful to strictly segment URIs into different types suchas URL, URN, and URC.
1015

被折叠的 条评论
为什么被折叠?



