0

Say for instance that you have the following path on a website:

/site/resources/img/bigImage.jpg

Now say that you replaced that path with the following path:

http://www.mydomain/site/resources/img/bigImage.jpg

is there a difference ( and i mean in performance) and if so how many images does it have to be for the site to be slowed down?

Marc Rasmussen
  • 19,771
  • 79
  • 203
  • 364

2 Answers2

3

These are relative and absolute URLs. See this SO question for thorough coverage of the topic, but best practices recommend relative URLs - i.e. /site/resources/img/bigImage.jpg

Edit: here's an article on the relative vs. URL question, which makes a good point: you will see a slight file size reduction with relative URLs. Unless you're looking at a huge number of images it probably won't be a major difference, but smaller is better when it comes to file size.

Community
  • 1
  • 1
Marcatectura
  • 1,721
  • 5
  • 30
  • 49
0

Use relative URLs in all instances where they are suitable to make your site work on any machine. If you use external URLs, your site will only be defined at one domain.


There is really no difference you will notice in performance, but as a general rule, it is better to use relative URLs in practice.

Liftoff
  • 24,717
  • 13
  • 66
  • 119