logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in  RSS Apache Lounge  


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.



Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Difference in efficiency between absolute and relative paths
Author
bazianm



Joined: 01 Jul 2014
Posts: 6
Location: Passaic, NJ

PostPosted: Tue 20 Feb '18 17:11    Post subject: Difference in efficiency between absolute and relative paths Reply with quote

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: 6661
Location: Germany, Next to Hamburg

PostPosted: Wed 21 Feb '18 13:27    Post subject: Reply with quote

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

PostPosted: Fri 23 Feb '18 14:28    Post subject: Reply with quote

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


Reply to topic   Topic: Difference in efficiency between absolute and relative paths View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner