HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 6. USING EXTERNAL RESOURCES 66


uncle or great aunt.


(1)http://example.com/abc/def/ghi/index.html


(2)../../photo.jpg


(3)http://example.com/abc/photo.jpg


We can also go the other way. If (1) is our absolute address, and (2) is
the relative address, then (3) is the matching absolute address. This is like
being a nephew or a niece.


(1)http://example.com/abc/def/ghi/index.html


(2)jkl/photo.jpg


(3)http://example.com/abc/def/ghi/jkl/photo.jpg


And we can combine the two directions. Go up a level, then turn around
and come back down a level. If (1) is our absolute address, and (2) is the
relative address, then (3) is the matching absolute address. This is like being
a cousin.


(1)http://example.com/abc/def/ghi/index.html


(2)../jkl/photo.jpg


(3)http://example.com/abc/def/jkl/photo.jpg


If (1) is our absolute address, and (2) is the relative address, then (3) is the
matching absolute address. This is like being a second cousin.


(1)http://example.com/abc/def/ghi/index.html


(2)../../jkl/mno/photo.jpg


(3)http://example.com/abc/jkl/mno/photo.jpg


6.8 DocRoot: Current Domain, Absolute Path


Relative addresses are relative to the domain name and path of the current
webpage.


We can create addresses that are relative to the current domain name, but
not the current path.


I will call theseDocRoot URLs.


We do that by starting the address with a slash.

Free download pdf