04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Q: What is important about the<br />

absolute path?<br />

A: The absolute path is what a server<br />

needs to locate the file you are requesting.<br />

If the server didn’t have an absolute path, it<br />

wouldn’t know where to look.<br />

Q: I feel like I understood the pieces<br />

(protocols, servers, Web sites, and<br />

absolute paths), but I’m having trouble<br />

connecting them.<br />

Sharpen your pencil<br />

there are no<br />

Dumb Questions<br />

A: If you add all those things together<br />

you have a URL, and <strong>with</strong> a URL you<br />

can ask a browser to retrieve a page (or<br />

other kinds of resources) from the Web.<br />

How? The protocol part tells the browser<br />

the method it should use to retrieve the<br />

resource (in most cases, this is HTTP).<br />

The Web site part (which consists of the<br />

server name and the domain name) tells<br />

the browser which computer on the Internet<br />

to get the resource from. And the absolute<br />

path tells the server what page you’re after.<br />

Q: We learned to put relative paths<br />

in the href attribute of our elements.<br />

How can the server find those links if<br />

they aren’t absolute?<br />

getting connected<br />

A: Wow, great question. When you<br />

click on a link that is relative, behind the<br />

scenes the browser creates an absolute<br />

path out of that relative path and the path of<br />

the page that you click on. So, all the Web<br />

server ever sees are absolute paths, thanks<br />

to your browser.<br />

Q: Would it help the browser if I put<br />

absolute paths in my <strong>HTML</strong>?<br />

A: Ah, another good question, but hold<br />

that thought, we’ll get back to that in a sec.<br />

You’ve waited long enough. It’s time to give your new URL a spin. Before you<br />

do, fill in the blanks below and then type in the URL (like you haven’t already). If<br />

you’re having any problems, this is the time to work <strong>with</strong> your hosting company to<br />

get things sorted out. If you haven’t set up an hosting company, fill in the blanks<br />

for www.starbuzzcoffee.com, and type the URL into your browser anyway.<br />

://<br />

protocol Web site name absolute path<br />

you are here 139

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!