Reputation: 3763
I have learned that browsers can only load a few files from the same domain at the same time. Therefore you should place your images on a different domain, or on a subdomain, to speed up page performance. Something like that...
Is it worth building websites like this, or will browsers change this function soon? Or maybe they already have?
Or maybe better asked: Will it soon become unnecessary to load your images from other domains for page performance?
The websites I am building now will not have their images hosted on a CDN.
Upvotes: 1
Views: 5195
Reputation: 7123
The browser limits the concurrent HTTP connections to a single server for the server's sake. While the limits have been increased in most browsers over time, there will always be limitations in web development and if you're a serious web developer you should suck it up and adopt the current best practices for working within them.
Without hosting your images on a CDN you can reduce the number of requests by combining your images into CSS sprites (archived) when appropriate. Check out the logo on StackOverflow, for example :)
Also, combine your CSS and Javascript into single files for production deployments.
Upvotes: 1
Reputation: 9676
A second reason that you might do this: if the images are being provided by users (avatar uploads e.g.), then you should host these from a separate domain to avoid any javascript that might be injected from having access to user cookies on your main application domain.
From what I understand this is a little esoteric, but there are some proofs of concept, and this is why Google uses a separate domain.
Upvotes: 3
Reputation: 2415
You can use a subdomain like static.example.com
to serve static files like images and videos. The advantage of such a usage will be on server side where you serve static.example.com
from a fast server like nginx while keeping the example.com
proxied to apache. As a result of this client will be able to download these static resources faster since they are served faster.
Upvotes: 2