Files (jQuery, jQuery UI, prototype) from external server
Asked Answered
B

3

0

If I have to load for example jquery.js file among some (let's tell about 10) other css / js files, what is a better approach?

"Using the google.load() method gives your application high speed and global access to a growing list of the most popular, open-source JavaScript libraries"

Burschenschaft answered 1/6, 2011 at 10:25 Comment(1)
Depends on where your audience are. If on an intranet an internally hosted version should load faster.Asphyxiant
P
2

Use Google. There's a good chance this will already be cached on the client's computer since lots of people use it, so it may be faster.

Puiia answered 1/6, 2011 at 10:29 Comment(1)
still doesn't combat all the other issues relevant to web page performance. It's fine if you only have one or two js files. But if you have 10 js and 10 css files i would recommend another approach.Shippen
S
2

Take a look here: Web Performance best Practices

Summarized:

ideally you should have all static content on subdomains like static1.example.org, static2.example.org. Which increases paralellity for downloads (increasing page load/render speed). in addition you should merge css files and js files, minify them and gzip them to reduce the number of roundtrips and the payload size. (mod_pagespeed is a apache module which can do this for you)

Also your content should be cached with a 1-year cache settings and version controlled (by naming convention, also available with mod_pagespeed)

Shippen answered 1/6, 2011 at 10:34 Comment(0)
M
1

External servers, so called CDNs can be used to speed up the website, when e.g. they are located closer, or the file was used on another website and is already cached.

However, if your website is official, must be reliable, SaaS or whatever then using public CDNs is not advised. the option is then to buy commercial CDNs or host internally.

Magaretmagas answered 1/6, 2011 at 10:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.