0

我在 gtmetrix.com 上查看了我的 MyBB 论坛,并提供了以下性能报告:

http://gtmetrix.com/reports/www.forum.joorchin.net/TdxokjnO

现在我有很多问题要提高页面速度和 YSlow 等级。

  1. 如何推迟 javaScripts 的解析?
  2. 如何从静态资源中删除查询字符串?
  3. 如何缓存 .swf 和 .js 文件?(利用浏览器缓存)
  4. 如何提高 YSlow 选项卡中的推荐分数?(中优先级和高优先级)?
4

2 回答 2

1

1- I think by defering parsing the javascript, they mean by putting all javascript at the end, or loading javascript asynchronously. Basically when a browser sees a script tags, it stops rendering the page until the javascript is interpreted in the script tag. Thats why its suggested to place all javascript at the end of a html page. you may or may need to change your code/js to handle this.

3 For caching .swf / .js files , if you are using Apache enable the expires module and set the revelant expires headers for the same

于 2012-08-09T12:16:57.913 回答
0

不要让你的 JS 加载复杂化,只需将它们合并到一个 JS 文件中并缩小它(如果可能的话)。对你的 CSS 做同样的事情,这样每次页面加载你只请求一个 JS 文件和一个 CSS 文件。

然后使用 Apache 通过将这些Apache 设置添加到.htaccess或来控制所有资源类型的缓存标头http.conf

如果您有一个图像重的页面设计,您还可以考虑使用图像精灵来减少从服务器检索的图像数量。还要确保使用 Fireworks、Photoshop 等良好的网络图像处理工具压缩图像(即更小的 KB 大小)。

大多数性能问题与发出的 HTTP 请求数有关。你问缓存是对的,但是初始页面加载(即在缓存被填充之前)也很重要,因为它是访问者对你网站的第一印象。

于 2012-08-09T13:02:58.350 回答