标签: yslow

"把脚本放在底部"是正确的吗?

在改进网站性能的最佳实践http://developer.yahoo.com/performance/rules.html中,史蒂夫·索德斯提到了一条规则"将脚本移到底部".这有点令人困惑.实际上,我注意到很多网页没有把脚本放在底部,而YSlow仍然标记这些页面的A.

那么,我何时应该遵循"将脚本放在底部"的规则?

javascript performance yslow

44
推荐指数
5
解决办法
2万
查看次数

添加Expires标头

Add Expires headers
There are 21 static components without a far-future expiration date.

    http://static.doers.lk/examples-offline.css
    http://static.doers.lk/kendo.common.min.css
    http://static.doers.lk/kendo.default.min.css
    http://static.doers.lk/style.css
    http://static.doers.lk/jquery.min.js
    http://static.doers.lk/kendo.web.min.js
    http://static.doers.lk/console.js
    http://static.doers.lk/sprite.png
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    http://static.doers.lk/favicon.PNG
Run Code Online (Sandbox Code Playgroud)

当我使用雅虎YSLOW测试网站时,它说上面按摩.所以我不知道如何添加过期的标题.任何帮助将不胜感激?

html yslow expires-header

44
推荐指数
2
解决办法
11万
查看次数

apache压缩Deflate .js和.css文件未压缩?

在Apache Im中通过将以下内容添加到我的.htaccess文件来启用输出压缩:

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Or, compress certain file types by extension:
<Files *.html>
SetOutputFilter DEFLATE
</Files>
Run Code Online (Sandbox Code Playgroud)

所以我用Content-Encoding服务所有内容:gzip但是当我用Yslow测试我的网页时,我收到:

Grade D on Compress components with gzip

There are 3 plain text components that should be sent compressed

* http://mysite.com/javascript/youTubeEmbed/youTubeEmbed-jquery-1.0.css
* http://mysite.com/javascript/jquery.swfobject.1-1-1.min.js
* http://mysite.com/javascript/youTubeEmbed/youTubeEmbed-jquery-1.0.js
Run Code Online (Sandbox Code Playgroud)

问题出在哪里?它们不应该自动压缩吗?

谢谢

卢卡

apache gzip deflate yslow

22
推荐指数
2
解决办法
4万
查看次数

如果脚本真的很短,是否使用内联JavaScript首选外部包含?

我在网站中使用外部JavaScripts,因为我总是试图将JavaScript保持在底层和外部.

谷歌的页面速度正在给出这个建议

以下外部资源具有较小的响应主体.在HTML中内联响应可以减少页面呈现的阻塞.

http:// websiteurl /应该内联以下小资源: http://websiteurl/script.js

此外部js文件仅包含此内容

$(document).ready(function() {
    $("#various2").fancybox({
        'width': 485,
        'height': 691,
    });
});
Run Code Online (Sandbox Code Playgroud)

但在Yslow,我得到了这个建议

关于Make JavaScript和CSS外部的等级n/a

如果您的属性是普通用户主页,请考虑这一点.

There are a total of 3 inline scripts
Run Code Online (Sandbox Code Playgroud)

每次请求HTML文档时,都会下载HTML文档中内联的JavaScript和CSS.这减少了HTTP请求的数量,但增加了HTML文档的大小.另一方面,如果JavaScript和CSS位于浏览器缓存的外部文件中,则HTML文档大小会减少,而不会增加HTTP请求的数量.

哪个是谷歌或雅虎?

javascript optimization jquery yslow google-pagespeed

20
推荐指数
1
解决办法
6459
查看次数

.htaccess,YSlow和"使用无cookie的域名"

YSlow的一个衡量标准是使用无cookie域来提供静态文件.

"当浏览器请求静态图像并发送带有请求的cookie时,服务器会忽略cookie.这些cookie是不必要的网络流量.要解决此问题,请确保通过创建子域来请求无cookie请求静态组件在那里托管他们." - 雅虎YSlow

我认为这意味着如果我将www.example.com/images移动到static.example.com/images,我可以获得性能提升.

虽然这很容易做到,但我会失去内容管理系统(Joomla/WordPress)中的便捷功能,以便轻松地引用和链接到这些图像.

是否有可能使用的.htaccess所有请求重定向在一个特定的文件夹www.example.com到一个文件夹上static.example.com呢?这种方法是否会欺骗CMS认为图像位于其自己域中的默认位置?

apache wordpress .htaccess joomla yslow

16
推荐指数
1
解决办法
7万
查看次数

在PHP中添加Expire Headers无法使其正常工作

我安装了Yslow附加组件

替代文字

当我在Yslow中检查我的应用程序时,我得到了Add Expires标题,我不知道

替代文字

我搜索了SO中的相关问题,Google也发现这种方法合适

<?
    header("Expires:".gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");
    ob_start();
    session_cache_limiter('public');
    session_start();
?>
<html>
Run Code Online (Sandbox Code Playgroud)

但它仍然表明我一样

因为我是新手,我对.htaccess了解不多

请帮助我提高应用程序性能

提前致谢

Wazzy

php performance .htaccess yslow

16
推荐指数
1
解决办法
5154
查看次数

.html,.css,.js的htaccess UTF-8编码 - 最好的方法是什么?

对于yslow页面速度,我想删除我的元标记并将我的编码放入.htaccess文件中.以下是我读过的所有方法.哪种方式首选?语言设置也是一个好主意 - 如果文件匹配的一面将适用于所有文件类型?

1)https://github.com/jancbeck/My-Wordpress-Boilerplate/blob/master/htaccess.txt

AddDefaultCharset utf-8
AddCharset utf-8 .html .css .js
DefaultLanguage en-US
Run Code Online (Sandbox Code Playgroud)

VS

2)http://www.askapache.com/htaccess/using-http-headers-with-htaccess.html

<filesMatch "\.(html|css|js)$">
AddDefaultCharset UTF-8
DefaultLanguage en-US
</filesMatch>
Run Code Online (Sandbox Code Playgroud)

VS

3)我怀疑这就是所需要的.但未经测试.

AddCharset UTF-8 .html .css .js
DefaultLanguage en-US
Run Code Online (Sandbox Code Playgroud)

.htaccess utf-8 yslow pagespeed

16
推荐指数
1
解决办法
5万
查看次数

如何使用无cookie域名(yslow)

我试图解决问题cookie-free,yslow建议创建一个子域.我做了,但yslow仍然"显示"问题.

我没有在页面中设置cookie的域名,因为我不知道该怎么做.

有谁知道这个问题的教程或解决方案?

subdomain set yslow

16
推荐指数
2
解决办法
5万
查看次数

如何在Firefox中启用YSlow?

我已经将最新版本的YSlow和Firebug安装到Windows 7上的最新版本的Firefox中(并重新启动了Firefox),但是当我点击YSlow时没有任何反应.此外,当我点击Firebug时,它会打开,但没有YSlow选项卡.我已禁用所有其他Firefox插件并右键单击YSlow并单击运行一次并自动运行.

我究竟做错了什么?

firefox firebug firefox-addon yslow

15
推荐指数
1
解决办法
4万
查看次数

Tomcat压缩不会在标头中添加内容编码:gzip

我正在使用Tomcat压缩我的HTML内容,如下所示:

<Connector port="8080" maxHttpHeaderSize="8192"
maxProcessors="150" maxThreads="150" minSpareThreads="25"
maxSpareThreads="75" enableLookups="false" redirectPort="8443"
acceptCount="150" connectionTimeout="20000" disableUploadTimeout="true"
compression="on" compressionMinSize="128" noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html"
URIEncoding="UTF-8" />
Run Code Online (Sandbox Code Playgroud)

然而,在HTTP标头中(通过YSlow观察),我没有看到

Content-Encoding: gzip
Run Code Online (Sandbox Code Playgroud)

导致Y​​Slow评分不佳.

我只看到了

HeadersPost
Response Headers
Server: Apache-Coyote/1.1
Content-Type:   text/html;charset=ISO-8859-1
Content-Language:   en-US
Content-Length: 5251
Date:   Sat, 14 Feb 2009 23:33:51 GMT
Run Code Online (Sandbox Code Playgroud)

我正在运行apache mod_jk Tomcat配置.

如何使用Tomcat压缩HTML内容,还在标题中添加"Content-Encoding:gzip"?

java tomcat gzip yslow

14
推荐指数
1
解决办法
2万
查看次数