Because of some apache rewrite rules in a project I'm working on, it's convenient to make href's and links in general absolute, because that assures that the browser will find the file behind that link, no matter what the URL is.
Example:
<img src="http://localhost/project/gfx/abc.jpg"></img>
instead of
<img src="gfx/abc.jpg"></img>
Would the former be slower than the latter, or in any way not as good?
It's not like I think of this as optimization; I guess I will use the absolute ones anyways (unless there's a really good reason not to do), but I'm interested in knowing whether using absolute URL's are OK or not.
Note that this will apply to all links/paths (hyperlinks, css and javascript includes, AJAX-calls etc.)
It won't make a bit of difference. You might prefer to do this though:
<img src="/project/gfx/abc.jpg" />
The browser will figure out the domain for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With