glasspoole — 2011-06-20T11:08:11-04:00 — #1
maybe its a stupid question and its something i just realized when i was surfing around. Don't know what others do, but i have the bad habit to look into source codes while surfing the web :rolleyes:
What i see is that for example all WP sites have the full url to stylesheets in the head: http :// www. blablub. com/theme/css.css
Does it make a difference if there is just: /theme/css.css
I mean does it not take an extra dns lookup if i put the full url in?
stevie_d — 2011-06-20T11:43:45-04:00 — #2
The only difference in terms of overhead if you put the full URL or a short one is the extra bandwidth taken to transmit the domain name, and those few bytes are going to make absolutely no difference. The parsing is all done by the browser before it sends a request. (You can tell this by writing a page with internal links given by both full and short URLs. Hover your mouse over them in turn - you'll see that in both cases, the link destination is the full URL)
One advantage of just using the short form of the URL (either relative or root reference) is that it makes your code more portable – you can move it to another site without having to rewrite all the links. On the other hand, if you use the full URL (absolute reference), anyone downloading your page onto their computer (do people still do that, in these days of broadband?) will still get the stylesheet regardless of what option they save it with.
I tend to just use the relative/root reference, but that's because it's less to type, and I'm lazy
glasspoole — 2011-06-20T12:20:52-04:00 — #3
Sure, but this is just a question on static pages. In php or a cms you set it in one place. So if you move your cms you change the settings and its done.