From: Subject: JumpStart to the Web technologies tutorial: Universal Resource Locator Date: Thu, 14 Nov 2002 10:48:10 +0100 MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_000_0019_01C28BCB.52BF0EB0"; type="text/html" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 This is a multi-part message in MIME format. ------=_NextPart_000_0019_01C28BCB.52BF0EB0 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Content-Location: http://www.sergey.com/web_course/part_3.html JumpStart to the Web technologies tutorial: Universal = Resource Locator
Jumpstart into=20 the Web technologies: <- Prev. Start Contents References Home Next=20 ->
URL=20 - Universal Resource Locator

How do you give an address to some resource on the Internet?=20 URL.
Universal Resource Locator (URL) is basically the unique address = for a=20 resource on the Internet. General structure of the URL is the following: =

scheme://hostname[:port]/path/filename=20

Where scheme is basically protocol, by = which=20 resource should be accessed. Depends on the scheme the URL can = look a=20 differently, here is the list of the most commonly used schemes:=20
http - HyperText Transfer Protocol (WWW server protocol), = the=20 most used one.=20
The format of this type of URL=20 = is:
http://[user:password]@hostname[:port]/path/filename[#label= |parameters],=20 where:=20
  • user & password - Username and password for http=20 authentication. They are optional and in most cases are not used. = It's also=20 not a good idea to use them in the URL because of security problems = it may=20 cause. If omitted and resource requires authentication, user will be = prompted.=20
  • hostname - Hostname of the computer where resource is = residing.=20 If ommited, the current hostname is used (the one of the current = URL).=20
  • port - port number, by default 80 for http.=20
  • path - path to resource inside the computer. If = omitted,=20 current path is used. Note, that if hostname is omitted you can use = the=20 relative path instead of the full path, which is very usefull = feature if you=20 need to build the documents and need easily move them to other=20 place.
    e.g.: in document http://www.company.com/misc/main.html = you need=20 to link to http://www.company.com/misc/part1/chapter1.html, so = instead of=20 using the full URL you can use just "part1/chapter1.html".=20
  • filename - filename of the resource, if omitted, = index.html is=20 used (it's actually configurable in httpd config files)=20
  • label - label inside the file, used to position the = browser=20 inside the file=20
  • parameters - CGI parameters that can be specified (GET = method).=20
All of these fields are actually optional, in case if = field is=20 omitted default is used.
Note: That it's better to use URLs = with as=20 fewer fields as possible, because it allows you to build much more = portable=20 documents. For example if you put in you document the full path and = you need=20 to move it some place else, you'll have to change all the URLs inside = your=20 documents. But if you use the relative path (without hostname & = and with=20 relative path instead of the absolute one, most likely you = won't need=20 to change anything.=20

ftp - File Transfer protocol=20 =
ftp://[user:password]@hostname[:port]/path/filename, = where=20 the meaning of the fields is similar to the http protocol.=20

mailto - Send e-mail=20
mailto:address - this will open new message in = your e-mail=20 composer (netscape).=20

news - Usenet news protocol=20
news://server-name/groupname, where:=20
  • server-name - hostname of the news server=20
  • groupname - name of the newsgroup
e.g.:=20 news://news.ne.mediaone.net/alt.os.unix

More info on URLs can be found here<= /I>=20

Jumpstart into=20 the Web technologies: <- Prev. Start Contents References Home Next=20 ->

Copyright =A9 2000 Sergey=20 Gribov
------=_NextPart_000_0019_01C28BCB.52BF0EB0 Content-Type: text/css; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Location: http://www.sergey.com/web_course/style.css .toolbar1 { PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; FONT-WEIGHT: bold; FONT-SIZE: = 8pt; PADDING-BOTTOM: 1pt; COLOR: #002255; PADDING-TOP: 1pt; FONT-FAMILY: = Tahoma, Arial, sans-serif } .toolbar2 { PADDING-RIGHT: 4pt; PADDING-LEFT: 4pt; FONT-WEIGHT: bold; FONT-SIZE: = 8pt; PADDING-BOTTOM: 1pt; COLOR: navy; PADDING-TOP: 1pt; FONT-FAMILY: = Tahoma, Arial, sans-serif } .title1 { PADDING-RIGHT: 4pt; PADDING-LEFT: 4pt; FONT-WEIGHT: bold; FONT-SIZE: = x-large; PADDING-BOTTOM: 7pt; COLOR: navy; PADDING-TOP: 10pt; = TEXT-ALIGN: center } .title2 { PADDING-RIGHT: 4pt; PADDING-LEFT: 4pt; FONT-WEIGHT: bold; FONT-SIZE: = x-large; PADDING-BOTTOM: 7pt; COLOR: navy; PADDING-TOP: 10pt; = TEXT-ALIGN: center; TEXT-DECORATION: underline } P { PADDING-RIGHT: 5pt; PADDING-LEFT: 5pt; PADDING-BOTTOM: 7pt; = PADDING-TOP: 7pt } ------=_NextPart_000_0019_01C28BCB.52BF0EB0 Content-Type: application/octet-stream Content-Transfer-Encoding: quoted-printable Content-Location: http://www.sergey.com/web_course/navig.js =0A= // Navigation function to go to the next / previous page=0A= // n is offset (1, -1 etc.)=0A= function goto_page (n) {=0A= var first =3D 0;=0A= var last =3D 14; // should be the next after the last one=0A= var part_name =3D "part_";=0A= var loc =3D window.location.href;=0A= var re =3D /(.*)\/(\w+)\.html([^\/]*)$/;=0A= var ra =3D re.exec(loc);=0A= =0A= // may be it ends with '/' instead of index.html=0A= if (ra =3D=3D null) {=0A= ra =3D re.exec(loc + "index.html");=0A= }=0A= var path =3D ra[1];=0A= var fname =3D ra[2]; =0A= =0A= // alert("=3D=3D" + ra[1] + "=3D=3D" + ra[2] + "=3D=3D" + ra[3]);=0A= =0A= if (n !=3D -1 && n !=3D 1) {=0A= alert("Hmmm... Wrong parameter to goto_page()...");=0A= }=0A= else if (fname =3D=3D "index" || fname =3D=3D "content") {=0A= if (n =3D=3D -1) {=0A= window.location.href =3D path + "/index.html";=0A= }=0A= else { // +1=0A= window.location.href =3D path + "/" + part_name + "1.html";=0A= }=0A= }=0A= else if (fname =3D=3D "reference") {=0A= if (n =3D=3D -1) {=0A= window.location.href =3D path + "/" + part_name + last + ".html";=0A= }=0A= else { // +1=0A= window.location.href =3D path + "/reference.html";=0A= }=0A= }=0A= else {=0A= var re1 =3D new RegExp("^" + part_name + "(\\d+)");=0A= var ra1 =3D re1.exec(fname);=0A= var num =3D parseInt(ra1[1]);=0A= if (num !=3D null) {=0A= num +=3D n;=0A= if (num > last) {=0A= window.location.href =3D path + "/reference.html";=0A= }=0A= else if (num <=3D first) {=0A= window.location.href =3D path + "/index.html";=0A= }=0A= else {=0A= window.location.href =3D path + "/" + part_name + num + ".html";=0A= }=0A= }=0A= else {=0A= alert("Hmmm... the filename " + fname + " looks strange...");=0A= }=0A= }=0A= }=0A= ------=_NextPart_000_0019_01C28BCB.52BF0EB0--