English 中文(简体)
B. 对内联网网站的 Java稿文档的合并
原标题:Aggressive Caching vs Combining of Javascript files for an Intranet Site

I m working on improving the page performance of my company s intranet page. We re looking to (dynamically) combine our javascript files as well as cache them for 30+ days. The page launches on login for everyone.

我的一位同事问,如果我们把联合材料档案整理起来一个月,它是否值得时间。 他犹豫不决,因为合并工具是服务器的一方,而且拖在我们的台上,需要稍加 ha的工作。

我曾做过一些研究,所看到的关于业绩的“我”的大多数建议是针对外部地点提出的。 由于我们重新陷入封闭的状态,如果每个人的藏匿点一成不变,我们就似乎不会从合并档案中受益。 将这些档案合并起来会告诉我们,侵略性敲打会失败吗?

如果出现这种变化,我们就重新讨论第8号国际文件。

最佳回答

印有多份 Java本文件的最显著影响是提供该网页所需的时间。 每一笔记本都分别处理,并为整个立案程序增加时间。

可在以下网址找到一个很好的答案:multiple versus onescript tags

If we are talking a large number of scripts then you may see an improvement in render time; if it is just two or three files then it likely won t bring abount a noticable difference once the files have been cached.

我建议对这页进行测试,使这两页都能够有时间,看看你对你的情况有何改进,并根据这一信息做出决定。

As a useful example, here are some stats from Xpedite (runtime minification tool I created a while back); note the difference in time from load to ready for combined vs uncombined scripts.

问题回答
  1. Combine all your JavaScript files into a single big file (thus minimizing the number of requests made to the server), and set its name to something like "application_234234.js"; the number represents the last time you have changed the file and will help the browser know it s a new file (thus no cache when you change it).
  2. Add an Expires or a Cache-Control Header (set it really far into the future). Since the file name will change each time you ll modify it, you don t have to worry.
  3. Last and not least, compress and gzip the JavaScript file.

这些是一些重要的建议,但更多地了解以下方面的最佳做法:





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签