|
Home >> FAQs/Tutorials >> XHTML Tutorials and Tips >> Index
XHTML 1.0 Tutorials - Understanding Hyper Links and URLs
By: FYICenter.com
Part:
1
2
3
4
5
6
(Continued from previous part...)
What Happens If Protocol or Port Number Is Missing in a URL?
From a syntax point of view, all URL parts are optional.
If some parts are not included in a URL, the browser and the hosting computer
will provide default values. Here are some rules about the protocol name,
host name, and port number:
1. If the protocol name part is missing, but the host name part is given,
"http://" will be used as the default value. The following URLs are identical:
dev.fyicenter.com/faq/xhtml/
http://dev.fyicenter.com/faq/xhtml/
2. If the port number part is missing, but the host name part is given,
the default port number that matches the protocol name will be used.
The following URLs are identical:
dev.fyicenter.com/faq/xhtml/
dev.fyicenter.com:80/faq/xhtml/
http://dev.fyicenter.com/faq/xhtml/
http://dev.fyicenter.com:80/faq/xhtml/
3. If the port number part is given, the host name part must be specified.
The following URLs are invalid:
http://:8080/
:80
What Happens If a URL Starts with Path or File name?
If a URL starts with a path name, the browser will
borrow the protocol name, the host name, and the port number from the URL of
the current document to make up the missing parts. For example,
if the following URL is used in this document you are viewing right now:
/faq/xhtml/index.html
your browser will borrow the protocol name, the host name, and the port number
from the URL of this document, and produce the following URL:
http://dev.fyicenter.com:80/faq/xhtml/index.html
If a URL starts with a file name, the browser will
borrow the protocol name, the host name, the port number,
and the path name from the URL of
the current document to make up the missing parts. For example,
if the following URL is used in this document you are viewing right now:
index.html
your browser will borrow the protocol name, the host name, the port number,
and the path name from the URL of this document, and produce the following URL:
http://dev.fyicenter.com:80/faq/xhtml/index.html
What Is a Relative Path Name?
A relative path name is a path name that starts without the leading slash "/".
If a relative path name is used in a URL, the relative path name will be
replaced with the current document path name appended with the specified relative
path name.
If "." or ".." is used in path names, it will be interpreted
as "current directory" or "parent directory" respectively.
For example, if the following URLs are used in this document
you are viewing right now:
./index.html
../index.html
../../index.html
../../faq/css/index.html
image/fyi.jpg
your browser will borrow the protocol name, the host name, the port number,
and the path name from the URL of this document, and produce the following URLs:
http://dev.fyicenter.com:80/faq/xhtml/index.html
http://dev.fyicenter.com:80/faq/index.html
http://dev.fyicenter.com:80/index.html
http://dev.fyicenter.com:80/faq/css/index.html
http://dev.fyicenter.com:80/faq/xhtml/image/fyi.jpg
(Continued on next part...)
Part:
1
2
3
4
5
6
|