开发者

What is the cost of calling jQuery and jQuery UI on every page?

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. I开发者_如何学JAVAt 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?


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


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


Including less Javascripts will Make fewer HTTP requests

which will Increase your site performance.

Yslow Performance Issue

What is the cost of calling jQuery and jQuery UI on every page?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜