<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>网站前端,web前端,前端脚本,前端优化&#124;时代前端 &#187; 前端</title>
	<atom:link href="http://www.52shidai.com/tag/%e5%89%8d%e7%ab%af/feed" rel="self" type="application/rss+xml" />
	<link>http://www.52shidai.com</link>
	<description>网站前端研究中心</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:36:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Web 前端优化最佳实践之 内容篇</title>
		<link>http://www.52shidai.com/seo/187.html</link>
		<comments>http://www.52shidai.com/seo/187.html#comments</comments>
		<pubDate>Thu, 04 Mar 2010 07:19:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[优化]]></category>
		<category><![CDATA[前端]]></category>

		<guid isPermaLink="false">http://52shidai.com/?p=187</guid>
		<description><![CDATA[Yahoo! 的 Exceptional Performance team 在 Web 前端方面作出了卓越的贡献。广为人知的优化规则也由 13 条到 14 条，再到 20 条，乃至现在的 34 条&#8211;真是与时俱进啊。最新的 34 条也针对不同的角度做了分类。 面向内容的优化规则目前有 10 条。 1. 尽量减少 HTTP 请求 (Make Fewer HTTP Requests) 作为第一条，可能也是最重要的一条。根据 Yahoo! 研究团队的数据分析，有很大一部分用户访问会因为这一条而取得最大受益。有几种常见的方法能切实减少 HTTP 请求： 1) 合并文件，比如把多个 CSS 文件合成一个； 2) CSS Sprites 利用 CSS background 相关元素进行背景图绝对定位；参见：CSS Sprites: Image Slicing&#8217;s Kiss of Death 3) 图像地图 4) 内联图象 [...]]]></description>
			<content:encoded><![CDATA[<p>Yahoo! 的 Exceptional Performance team 在 Web <span class='wp_keywordlink'><a href="http://www.52shidai.com" title="时代前端" target="_blank">前端</a></span>方面作出了卓越的贡献。广为人知的<a href="http://developer.yahoo.com/performance/rules.html">优化规则</a>也由 13 条到 14 条，再到 20 条，乃至现在的 <a href="http://developer.yahoo.com/performance/">34 条</a>&#8211;真是与时俱进啊。最新的 34 条也针对不同的角度做了分类。</p>
<p>面向内容的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e4%bc%98%e5%8c%96" title="查看 优化 中的全部文章" target="_blank">优化</a></span>规则目前有 10 条。</p>
<h4>1. 尽量减少 <acronym title="HyperText Transfer Protocol ">HTTP</acronym> 请求 (Make Fewer <acronym title="HyperText Transfer Protocol ">HTTP</acronym> Requests)</h4>
<p>作为第一条，可能也是最重要的一条。根据 Yahoo! 研究团队的数据分析，有很大一部分用户访问会因为这一条而取得最大受益。有几种常见的方法能切实减少 <acronym title="HyperText Transfer Protocol ">HTTP</acronym> 请求：</p>
<ul>
<li>1) <strong>合并文件</strong>，比如把多个 <acronym title="Cascading Style Sheets ">CSS</acronym> 文件合成一个；</li>
<li>2) <strong><acronym title="Cascading Style Sheets ">CSS</acronym> Sprites</strong> 利用 <acronym title="Cascading Style Sheets ">CSS</acronym> background 相关元素进行背景图<strong>绝对</strong>定位；参见：<a href="http://alistapart.com/articles/sprites">CSS Sprites: Image Slicing&#8217;s Kiss of Death</a></li>
<li>3) <strong>图像地图</strong></li>
<li>4) <strong>内联图象</strong> 使用 <a href="http://tools.ietf.org/html/rfc2397">data: URL scheme</a> 在实际的页面嵌入图像数据.</li>
</ul>
<h4>2. 减少 <acronym title="Domain Name System ">DNS</acronym> 查找 (Reduce <acronym title="Domain Name System ">DNS</acronym> Lookups)</h4>
<p>必须明确的一点，DNS 查找的开销是很大的。另外，我倒是觉得这是 Yahoo! 所有站点的通病，Yahoo！主站点可能还不够明显，一些分站点，存在明显的类似问题。对于国内站点来说，如果过多的使用了站外的 Widget ，也很容易引起过多的 <acronym title="Domain Name System ">DNS</acronym> 查找问题。</p>
<h4>3. 避免重定向 (Avoid Redirects)</h4>
<p>不是绝对的避免，尽量减少。另外，应该注意一些不必要的重定向。比如对 Web 站点子目录的后面添加个 / (Slash) ，就能有效避免一次重定向。http://www.dbanotes.net/arch 与 http://www.dbanotes.net/arch<strong>/</strong> 二者之间是有差异的。如果是 Apache 服务器，通过配置 Alias 或mod_rewrite 或是 DirectorySlash 能够消除这个问题。</p>
<h4>4. 使得 Ajax 可缓存 (Make Ajax Cacheable)</h4>
<p>响应时间对 Ajax 来说至关重要，否则用户体验绝对好不到哪里去。提高响应时间的有效手段就是 Cache 。其它的一些<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e4%bc%98%e5%8c%96" title="查看 优化 中的全部文章" target="_blank">优化</a></span>规则对这一条也是有效的。</p>
<h4>5. 延迟载入组件 (Post-load Components)</h4>
<h4>6. 预载入组件 (Preload Components)</h4>
<p>上面两条严格说来，都是属于<strong>异步</strong>这个思想灵活运用的事儿。</p>
<h4>7. 减少 <acronym title="Document Object Model ">DOM</acronym> 元素数量 (Reduce the Number of <acronym title="Document Object Model ">DOM</acronym> Elements)</h4>
<h4>8. 切分组件到多个域 (Split Components Across Domains)</h4>
<p>主要的目的是提高页面组件并行下载能力。但不要跨太多域名，否则就和第二条有些冲突了。</p>
<h4>9. 最小化 iframe 的数量 (Minimize the Number of iframes)</h4>
<p>熟悉 <acronym title="Search Engine Optimization ">SEO</acronym> 的朋友知道 iframe 是 <acronym title="Search Engine Optimization ">SEO</acronym> 的大忌。针对<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e5%89%8d%e7%ab%af" title="查看 前端 中的全部文章" target="_blank">前端</a></span>优化来说 iframe 有其好处，也有其弊端，一分为二看问题吧。</p>
<h4>10. 杜绝 http 404 错误 (No 404s)</h4>
<p>对页面链接的充分测试加上对 Web 服务器 error 日志的不断跟踪能有效减少 404 错误，亦能提升用户体验。值得一提的是，CSS 与 Java Script 引起的 404 错误因为定位稍稍”难”一点而往往容易被忽略。</p>
<p>这是内容篇的 10 条。应该说具体引导性的内容还不够详细。逐渐会根据自己的理解补充上来。</p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/seo/883.html" title="RSS对网站SEO优化的好处">RSS对网站SEO优化的好处</a></li><li><a href="http://www.52shidai.com/seo/877.html" title="如何优化网站内链建设">如何优化网站内链建设</a></li><li><a href="http://www.52shidai.com/seo/844.html" title="wordpress博客seo优化指南">wordpress博客seo优化指南</a></li><li><a href="http://www.52shidai.com/seo/817.html" title="提高论坛网站流量的三点要素">提高论坛网站流量的三点要素</a></li><li><a href="http://www.52shidai.com/web-front/809.html" title="Flickr 的开发者的 Web 应用优化技巧">Flickr 的开发者的 Web 应用优化技巧</a></li><li><a href="http://www.52shidai.com/web-front/806.html" title="Web 前端优化最佳实践之 Mobile(iPhone) 篇">Web 前端优化最佳实践之 Mobile(iPhone) 篇</a></li><li><a href="http://www.52shidai.com/web-front/804.html" title="Web 前端优化最佳实践之 图象篇">Web 前端优化最佳实践之 图象篇</a></li><li><a href="http://www.52shidai.com/web-front/801.html" title="Web 前端优化最佳实践之 JavaScript 篇">Web 前端优化最佳实践之 JavaScript 篇</a></li><li><a href="http://www.52shidai.com/web-front/799.html" title="Web 前端优化最佳实践之 CSS 篇">Web 前端优化最佳实践之 CSS 篇</a></li><li><a href="http://www.52shidai.com/web-front/797.html" title="Web 前端优化最佳实践之 Cookie 篇">Web 前端优化最佳实践之 Cookie 篇</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/seo/187.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>前端开发经验小结</title>
		<link>http://www.52shidai.com/seo/184.html</link>
		<comments>http://www.52shidai.com/seo/184.html#comments</comments>
		<pubDate>Thu, 04 Mar 2010 07:13:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[前端]]></category>
		<category><![CDATA[总结]]></category>

		<guid isPermaLink="false">http://52shidai.com/?p=184</guid>
		<description><![CDATA[xml文件尽量以utf-8编码，gb2312有些字是存储不了的，如?,就算能存也需要转换，比较麻烦，utf-8也符合国际规范 CSS中:hover这个伪类，如果放在:visited前面则会失效 &#60;a&#62;标签如果没有href属性，所有对它的css的伪类如:hover均失效 js文件中用document.wirte(“&#60;script language=&#8217;javascript&#8217; src=&#8217;” + file + “&#8216;&#62;&#60;/” + “script&#62;”形式的引用，其file相对路径均为引用该js的html的路径。 如：a.htm 引用x\b.js,b.js引用x\c.js,则file应该为x\c.js而不是相对b.js的直接路径c.js，而css中的@import,url()引用不存在这个问题 在页面中，有时talbe的宽设置为100%右边也会留下一个滚动条的空白，请设置&#60;body style=”overflow:auto”&#62; 对于常用的图片不要用img标签，使用&#60;span&#62;&#60;a&#62;并用css指定其背景和宽高，对于做动态的（移上去变背景），使用&#60;a&#62;最好，不需要额外编写代码，只要利用伪类:hover就好了，使用css好处是一次改变全部改变，这点可以很好的利用在换皮肤的应用中 @font-face { font-family:comic; src:url(http://valid_url/some_font_file.eot); } 定义一种在本地没有的字体名称，调用&#60;span style=”font-family:comic;font-size:18pt&#62;aa&#60;/span&#62; 几个CSS div { overflow: hidden;text-overflow:ellipsis; } td { vertical-align : middle; } 要强制溢出发生并且应用 ellipsis 值，作者必须设置对象的 white-space 属性值为 nowrap 。 假如没有换行机会(例如，对象容器的宽度是狭窄的，而内有很长的没有合理断行的文本)，没有应用 nowrap 也有可能溢出。 为了使 ellipsis 值被应用，此属性必须被设置到具有不可视区域的对象。最好的选择是设置 overflow 属性为 hidden。 firefox的document.createElement不支持内容里有HTML标签,也不支持innerText，但是支持innerHTML,可以用innerHTML指定其内容 .net控件里DropDownList在firefox下的宽度不着色，需要直接定义style=&#8217;width:10px;&#8217; firefox中css的cursor不支持hand,使用pointer代替 [...]]]></description>
			<content:encoded><![CDATA[<p>xml文件尽量以utf-8编码，gb2312有些字是存储不了的，如?,就算能存也需要转换，比较麻烦，utf-8也符合国际规范<br />
CSS中:hover这个伪类，如果放在:visited前面则会失效<br />
&lt;a&gt;标签如果没有href属性，所有对它的css的伪类如:hover均失效<br />
js文件中用document.wirte(“&lt;script language=&#8217;javascript&#8217; src=&#8217;” + file + “&#8216;&gt;&lt;/” + “script&gt;”形式的引用，其file相对路径均为引用该js的<a href="http://52shidai.com/archives/tag/html">html</a>的路径。</p>
<p>如：a.htm 引用x\b.js,b.js引用x\c.js,则file应该为x\c.js而不是相对b.js的直接路径c.js，而css中的@import,url()引用不存在这个问题</p>
<p>在页面中，有时talbe的宽设置为100%右边也会留下一个滚动条的空白，请设置&lt;body style=”overflow:auto”&gt;<br />
对于常用的图片不要用img标签，使用&lt;span&gt;&lt;a&gt;并用css指定其背景和宽高，对于做动态的（移上去变背景），使用&lt;a&gt;最好，不需要额外编写代码，只要利用伪类:hover就好了，使用css好处是一次改变全部改变，这点可以很好的利用在换皮肤的应用中<br />
@font-face {<br />
font-family:comic;<br />
src:url(<a href="http://valid_url/some_font_file.eot">http://valid_url/some_font_file.eot</a>);<br />
}<br />
定义一种在本地没有的字体名称，调用&lt;span style=”font-family:comic;font-size:18pt&gt;aa&lt;/span&gt;<br />
几个CSS<br />
div { overflow: hidden;text-overflow:ellipsis; }<br />
td { vertical-align : middle; }<br />
要强制溢出发生并且应用 ellipsis 值，作者必须设置对象的 white-space 属性值为 nowrap 。<br />
假如没有换行机会(例如，对象容器的宽度是狭窄的，而内有很长的没有合理断行的文本)，没有应用 nowrap 也有可能溢出。<br />
为了使 ellipsis 值被应用，此属性必须被设置到具有不可视区域的对象。最好的选择是设置 overflow 属性为 hidden。<br />
firefox的document.createElement不支持内容里有HTML标签,也不支持innerText，但是支持innerHTML,可以用innerHTML指定其内容<br />
.net控件里DropDownList在firefox下的宽度不着色，需要直接定义style=&#8217;width:10px;&#8217;<br />
firefox中css的cursor不支持hand,使用pointer代替<br />
iframe里的滚动条需要在iframe标签里设置style=&#8217;overflow:hidden&#8217;,不能仅仅在body里设置，在firefox会有问题<br />
在onpropertychange事件时，注意使用event.propertyName对属性改变事件过滤，在设置本事件时，其实已经改变了onpropertychange这个属性，所以会自动的执行一次<br />
js5.6里的对XSL的支持版本较低，如document函数就不支持<br />
slice函数比直接循环获取数组片断慢<br />
nextSibling获得下一个对象时，需要注意，两个节点间不要有空格，否则很容易获取不到正确得对象<br />
CreateTextFile在有中文时必须指定第三个参数为true,否则不能写入中文，表现为Write写时报错<br />
保存中文文本时使用ADODB.stream,不使用fso,因为FSO不支持utf-8格式</p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/seo/187.html" title="Web 前端优化最佳实践之 内容篇">Web 前端优化最佳实践之 内容篇</a></li><li><a href="http://www.52shidai.com/javascript/jquery/90.html" title="Jquery 常用方法经典总结">Jquery 常用方法经典总结</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/seo/184.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

