Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Difference in efficiency between absolute and relative paths |
|
Author |
|
bazianm
Joined: 01 Jul 2014 Posts: 11 Location: Passaic, NJ
|
Posted: Tue 20 Feb '18 17:11 Post subject: Difference in efficiency between absolute and relative paths |
|
|
Hi,
I am curious. If I am embedding an image in a page, is there a difference in efficiency between
<img src="http://www.mydomain.com/path/to/image.jpg">
and
<img src="/path/to/image.jpg">?
Same for js, css and other files... |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 21 Feb '18 13:27 Post subject: |
|
|
There is no difference. Except when you run your page over SSL you have mixed content since you call the media from http://
The best method I think is to use absolute paths without domain name. |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Fri 23 Feb '18 14:28 Post subject: |
|
|
Well, the less characters you have to send over the line the less bandwidth you use.
So a shorter (relative) URL's will save you a tiny bit of bandwidth. Making it marginally more efficient.
However you probably won't notice this difference. |
|
Back to top |
|
|
|
|
|
|