40 likes | 50 Views
Learn about the differences between absolute and relative hyperlinks and how to use them for effective website navigation. Explore examples and understand folder structures to create accurate hyperlinks.
E N D
Hyperlinks recap DSC340 Mike Pangburn
Basic idea • Absolute hyperlink • Starts navigation from the “top” of the webserver’s folder chain • Examples • href = “www.aserver.com/subfolder1/subfolder2/file.txt” • href = “/subfolder1/subfolder2/file.txt” • In this case the domain name is omitted, so the webserver assumes the current webserver • Relative hyperlink • Starts navigation from the current folder (i.e., of the file containing the link) • Meaning of “..” and “.” folder path part of link: • “..” means go up a level • “.” means start at current folder (the default) • Examples • href= “./subfolder1/subfolder2/file.txt” • href = “subfolder1/subfolder2/file.txt” • The two above links are equiv.: starting in current folder, go down two levels and go to file.txt • href = “../../subfolder3/file.txt” • Go up two folder levels, then go down into “subfolder3” and go to file.txt
Folder structure for add’l examples public_html Server: gr8bikes.com mtb 700c all700c.html allmtb.html 26er 29er road CX m1.html niner.html r1.html cx1.html m2.html r2.html cx2.html
Examples • From within the file allmtb.html, you want to create a hyperlink to the file niner.html • Here are some alternatives: • href = http://www.gr8bikes.com/mtb/29er/niner.html • href = “/mtb/29er/niner.html • href = “./29er/niner.html • href = “29er/niner.html • this would work to…href = “../mtb/29er/niner.html”