CS 142 Lecture Notes: URLs and Links Slide 1
Uniform Resource Locators (URLs)
http://www.company.com:81/a/b/c.html?user=Alice&year=2008#p2
Scheme
Host Name
Port Number
Hierarchical portion
Query
Fragment
CS 142 Lecture Notes: URLs and Links Slide 2
<a> Examples
● Full URL:
<a href="http://www.xyz.com/news/2009.html">2009 News</a>
● Relative location:
<a href="2008/March.html">
same as http://www.xyz.com/news/2008/March.html
● Absolute location in same site:
<a href="/stock/quote.html">
same as http://www.xyz.com/stock/quote.html
● New location, same page:
<a href="#sec3">
● Anchor definition:
<a name="sec3">...</a>
CS 142 Lecture Notes: URLs and Links Slide 3

URL

  • 1.
    CS 142 LectureNotes: URLs and Links Slide 1 Uniform Resource Locators (URLs) http://www.company.com:81/a/b/c.html?user=Alice&year=2008#p2 Scheme Host Name Port Number Hierarchical portion Query Fragment
  • 2.
    CS 142 LectureNotes: URLs and Links Slide 2 <a> Examples ● Full URL: <a href="http://www.xyz.com/news/2009.html">2009 News</a> ● Relative location: <a href="2008/March.html"> same as http://www.xyz.com/news/2008/March.html ● Absolute location in same site: <a href="/stock/quote.html"> same as http://www.xyz.com/stock/quote.html ● New location, same page: <a href="#sec3"> ● Anchor definition: <a name="sec3">...</a>
  • 3.
    CS 142 LectureNotes: URLs and Links Slide 3