On Sunday 27 September 2009 11:45:40 pm Hunt J. wrote:
I expect a user to input a HTTP or HTTPS URL. e.g., http://abcdef.gov
Maybe using URI seems too generic after the research as ‘uri’ means
different protocols, not just http/https.
Well, a URI isn’t even required to work. Just a clarification:
A URL is meant to actually refer to a resource. For example,
http://ruby-lang.org/
actually refers to a working website, and is thus a URL – thus, the
protocol
must be something that actually exists, and as a practical matter,
you’ll want
it to be something you (or your browser) know how to handle.
A URI only needs to be globally unique. For example:
http://www.w3.org/1999/xhtml
It doesn’t matter AT ALL whether this points to a working resource. The
Web
will continue to work, even if w3.org completely implodes. As a matter
of
courtesy, the W3C has actually made this a valid URL, which points to a
description of what that namespace is, and the specifications that use
it –
but when your browser sees that URI at the top of a web page:
It doesn’t actually talk to w3.org at all. It just knows internally that
this
namespaces is where HTML elements go in an XHTML document.
On a completely unrelated note, if you know how XML namespaces work,
technically, the following would probably work, on browsers that
understand
XHTML:
<foobar:html xmlns:foobar=‘http://www.w3.org/1999/xhtml’>
foobar:head
…
</foobar:head>
foobar:body
…
</foobar:body>
</foobar:html>
I suspect that the spec explicitly disallows this, at least in the
“transitional” mode, because it’s not backwards compatible with HTML
4.0. But
the point is, internally, the browser is looking for an html element
associated with that URI – which is why it’s not a valid xhtml document
if
you don’t include that xmlns in some form.