2

I have an intranet site where half of the pages use jQuery, and ~20% use jQuery UI. Users who navigate the site will almost certainly open a page containing jQuery UI during their visit.

What I'd like to do is use for all pages a standard template that includes calls to jQuery and jQuery UI. It would make the site maintenance easier, but it also means that for 80% of my pages jQuery UI will be loaded for nothing.

What I have been told is that I should not worry too much about that. Calls to jQuery and jQuery UI will be cached by the browser, so anyway they'll only be called once during the user's visit.

Is this correct? Or are there other performance factors that could make the systematic call a bad idea?

Christophe
  • 27,383
  • 28
  • 97
  • 140
  • Not to forget about cost of *not* having jQuery/other libs for dealing with cross-browser issues, ease of use, lesser code and more. – Sarfraz Jan 23 '11 at 09:38

3 Answers3

2

You heard right. The files remain cached in the browser, so don't worry about that.

Julio Santos
  • 3,837
  • 2
  • 26
  • 47
1

In short — yes. Don't worry about it too much. Especially in an intranet application. If you want to improve load times combine your JS files into on single file and compress this file.

Here's one of many questions on SO which deals with this solution (in this case using PHP): Combining and Compressing multiple JavaScript files in php

Community
  • 1
  • 1
polarblau
  • 17,649
  • 7
  • 63
  • 84
1

Including less Javascripts will Make fewer HTTP requests

which will Increase your site performance.

Yslow Performance Issue

YSLOW Preview

Wazy
  • 8,822
  • 10
  • 53
  • 98
  • Thanks for this list. But if I understand correctly, the two additional http requests are not a big deal. This advice is more for pages that load a bunch of small files (many icons or short scripts). – Christophe Jan 23 '11 at 12:54