<?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>SEO | 酷 壳 - CoolShell</title>
	<atom:link href="https://coolshell.cn/tag/seo/feed" rel="self" type="application/rss+xml" />
	<link>https://coolshell.cn</link>
	<description>享受编程和技术所带来的快乐 - Coding Your Ambition</description>
	<lastBuildDate>Tue, 06 Dec 2011 17:26:56 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2</generator>
	<item>
		<title>Web开发中需要了解的东西</title>
		<link>https://coolshell.cn/articles/6043.html</link>
					<comments>https://coolshell.cn/articles/6043.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Wed, 07 Dec 2011 00:29:49 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[安全]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=6043</guid>

					<description><![CDATA[<p>在StackExchange上有人问了这样一个问题：What should every programmer know about web developmen...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/6043.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/6043.html">Web开发中需要了解的东西</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>在StackExchange上有人问了这样一个问题：<a href="http://programmers.stackexchange.com/questions/46716/what-should-every-programmer-know-about-web-development" target="_blank">What should every programmer know about web development?</a>（关于Web开发，什么是所有程序员需要知道的？）里面给出的答案非常不错，所以，我翻译转载过来。 顺便说一下，StackExchange真是非常好，大家可以对同一个答案做贡献和修订，看看这个问题的<a href="http://programmers.stackexchange.com/posts/46760/revisions" target="_blank">修订过程</a>你就知道了——专业的问答网站应该怎么去做。这就是我在这篇文章中也说过<a title="腾讯，竞争力 和 用户体验" href="https://coolshell.cn/articles/5901.html" target="_blank">真正的用户体验是什么样的</a>。</p>
<p>好了，下面是正文（我对原文做了一些批注，也许不对或有误导，请大家指正）</p>
<p>下面的这些东西可能对于大多数人并不陌生，但是可能会有些东西你以前并没有看过，或是没有完全搞懂，甚至都没有听说过。（陈皓注：我相信当你看完这个列表后，你会觉得对于我国的Web开发有点弱了，还是那句话，表面上的东西永远是肤浅的）</p>
<h4><strong>接口和用户体验</strong></h4>
<ul>
<li>小心浏览器的实现标准上的不一致，确信让你的网站能够适当地跨浏览器。至少，你的网站需要测试一下下面的浏览器：</li>
<ul>
<li>最新的 <a href="http://en.wikipedia.org/wiki/Gecko_%28layout_engine%29" rel="nofollow">Gecko</a> 引擎 (<a href="http://firefox.com/" rel="nofollow">Firefox</a>)，</li>
<li>一个 Webkit 引擎 (<a href="http://www.apple.com/safari/" rel="nofollow">Safari</a>, <a href="http://www.google.com/chrome" rel="nofollow">Chrome</a>, 或是其它的移动设备上的浏览器)</li>
<li> <a href="http://en.wikipedia.org/wiki/Internet_Explorer" rel="nofollow">IE 浏览器</a> (测试IE的兼容性你可以使用微软IE的 <a href="http://www.microsoft.com/Downloads/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&amp;displaylang=en" rel="nofollow">Application Compatibility VPC Images</a>)</li>
<li> <a href="http://www.opera.com/" rel="nofollow">Opera</a> 浏览器。</li>
</ul>
</ul>
<p style="padding-left: 30px;">最后，你可以使用一下<a href="http://www.browsershots.org/" rel="nofollow">这个工具</a> 来看看你的网页在不同的浏览器下是怎么被显示出来的（陈皓注：这个工具就是以前本站介绍过的<a title="如何检查网页浏览器的兼容性" href="https://coolshell.cn/articles/757.html" target="_blank">在不同浏览器和平台上检查你的网站的兼容性</a>）</p>
<ul>
<li>多考虑一下人们是怎么来访问你的网站而不是那些主流的浏览器：手机，读屏软件和搜索引擎，例如：一些Accessibility的东西： <a href="http://www.w3.org/WAI/" rel="nofollow">WAI</a> 和  <a href="http://www.section508.gov/" rel="nofollow">Section508</a>, 移动设备开发：<a href="http://mobiforge.com/" rel="nofollow">MobiForge</a>.</li>
</ul>
<ul>
<li>部署Staging：怎么部署网站的更新而不会影响用户的访问。 <a href="http://programmers.stackexchange.com/questions/46716/what-should-a-developer-know-before-building-a-public-web-site/46738#46738">Ed Lucas的答案</a> 可以让你了解一些（陈皓注：Ed说了一些如版本控制，自动化build，备份，回滚等机制）。</li>
</ul>
<ul>
<li>千万不要直接给用户显示不友好的错误信息。</li>
</ul>
<div><span id="more-6043"></span></div>
<ul>
<li>千万不要把用户的邮件地址以明文显示出来，这样会被爬虫爬走并被让用户的邮箱被垃圾邮件搞死。</li>
</ul>
<ul>
<li>为用户的链接加上 <code>rel="nofollow"</code> 的属性以 <a href="http://en.wikipedia.org/wiki/Nofollow" rel="nofollow">避免垃圾网站的干扰</a>。（陈皓注：<strong>nofollow</strong>是HTML的一个属性，用于通知搜索引擎“这个链接所指向的网页非我所能控制，对其内容不予置评”，或者简单地说，该链接不是对目标网站或网页的“投票”，这样搜索引擎不会再访问这个链接。这个是用来减少一些特定垃圾页面对原网站的影响，从而可以改善搜索结果的质量，并且防止垃圾链接的蔓延。）</li>
</ul>
<ul>
<li><a href="http://www.codinghorror.com/blog/archives/001228.html" rel="nofollow">为网站建立一些的限制</a> &#8211; 这个属于安全性的范畴。（陈皓注：比如你在Google注册邮箱时，你一口气注册超过两个以上的邮箱，gmail要求给你发短信或是给你打电话认证，比如Discuz论坛的会限制你发贴或是搜索的间隔时间等等，更多的网站会用CAPTCHA来确认是人为的操作。 这些限制都是为了防止垃圾和恶意攻击）</li>
</ul>
<ul>
<li>学习如何做 <a href="http://en.wikipedia.org/wiki/Progressive_enhancement" rel="nofollow">Progressive Enhancement</a>. （陈皓注：<a href="http://en.wikipedia.org/wiki/Progressive_enhancement" rel="nofollow">Progressive Enhancement</a>是一个Web Design的理念，如：1）基础的内容和功能应该可以被所有的浏览器存取，2）页面布局的应该使用外部的CSS链接，3）Javascript也应该是外部链接还应该是 <a title="Unobtrusive JavaScript" href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript">unobtrusive</a> 的，4）应该让用户可以设置他们的偏好）</li>
</ul>
<ul>
<li>如果POST成功，要<a href="http://en.wikipedia.org/wiki/Post/Redirect/Get" rel="nofollow">在POST方法后重定向网址</a>，这样可以阻止用户通过刷新页面重复提交。</li>
</ul>
<ul>
<li>严重关注Accessibility。因为这是<a href="http://www.section508.gov/" target="_blank">法律上的需求</a>（陈皓注：Section 508是美国的508法案，其是美国劳工复健法的改进，它是一部联邦法律，这个法律要求所有技术要考虑到残障人士的应用，如果某个大众信息传播网站，如果某些用户群体（如残疾人）浏览该网站获取信息时，如果他们无法正常获得所期望的信息（如无法正常浏览），那可以依据相关法规，可以对该网站依法起诉）。 <a href="http://www.w3.org/WAI/intro/aria" rel="nofollow">WAI-ARIA</a> 为这方面的事提供很不错的资源.</li>
</ul>
<h4><strong>安全</strong></h4>
<ul>
<li>在网上有很多关于安全的文章，但是 <a href="http://www.owasp.org/index.php/Category%3aOWASP_Guide_Project" rel="nofollow">OWASP 开发指导</a> 涵盖了几乎所有关于Web站点安全的东西。（陈皓注：OWASP(开放Web应用安全项目- Open Web Application Security Project)是一个开放的非营利性组织，目前全球有130个分会近万名会员，其主要目标是研议协助解决Web软体安全之标准、工具与技术文件，长期 致力于协助政府或企业了解并改善网页应用程式与网页服务的安全性。OWASP被视为Web应用安全领域的权威参考。2009年下列发布的美国国家和国际立法、标准、准则、委员会和行业实务守则参考引用了OWASP。美国联邦贸易委员会(FTC)强烈建议所有企业需遵循OWASP十大WEB弱点防护守则）</li>
</ul>
<ul>
<li>了解什么是 <a href="http://en.wikipedia.org/wiki/SQL_injection" rel="nofollow">SQL 注入攻击</a> 并知道怎么阻止这种攻击。</li>
</ul>
<ul>
<li>永远不要相信用户的输入（包括Cookies，因为那也是用户的输入）</li>
</ul>
<ul>
<li>对用户的口令进行Hash，并使用salt，以防止Rainbow 攻击（陈皓注：Hash算法可用MD5或SHA1等，对口令使用salt的意思是，user 在设定密码时，system 产生另外一个random string(salt)。在datbase 存的​​是与salt + passwd 产的md5sum 及salt。 当要验证密码时就把user 输入的string 加上使用者的salt，产生md5s​​um 来比对。 理论上用salt 可以大幅度让密码更难破解，相同的密码除非刚好salt 相同，最后​​存在database 上的内容是不一样的。google一下md5+salt你可以看到很多文章。关于<a href="http://en.wikipedia.org/wiki/Rainbow_table" target="_blank">Rainbow 攻击</a>，其意思是很像密码字典表，但不同的是，Rainbow Table存的是已经被Hash过的密码了，而且其查找密码的速度更快，这样可以让攻击非常快）。使用慢一点的Hash算法来保存口令，如 bcrypt (被时间检证过了) 或是 scrypt (更强，但是也更新一些) (<a href="http://www.tarsnap.com/scrypt.html" rel="nofollow">1</a>, <a href="http://it.slashdot.org/comments.pl?sid=1987632&amp;cid=35149842" rel="nofollow">2</a>)。你可以阅读一下 <a href="http://codahale.com/how-to-safely-store-a-password/" rel="nofollow">How To Safely Store A Password</a>（陈皓注：酷壳以前曾介绍过<a title="如何防范密码被破解" href="https://coolshell.cn/articles/2078.html" target="_blank">bcrypt这个算法</a>，这里，我更建议我们应该让用户输入比较强的口令，比如Apple ID注册的过程需要用户输入超过8位，需要有大小写和数字的口令，或是做出类似于<a title="另类UX让你输入强口令" href="https://coolshell.cn/articles/3877.html" target="_blank">这样的用户体验的东西</a>）。</li>
</ul>
<ul>
<li><a href="http://stackoverflow.com/questions/1581610/how-can-i-store-my-users-passwords-safely/1581919#1581919">不要试图自己去发明或创造一个自己的fancy的认证系统</a>，你可能会忽略到一些不容易让你查觉的东西而导致你的站点被hack了。（陈皓注：我在<a title="如何设计“找回用户帐号”功能" href="https://coolshell.cn/articles/5987.html" target="_blank">腾讯那坑爹的申诉系统</a>中说过这个事了，我说过这句话——“真正的安全系统是协同整个社会的安全系统做出来的一道安全长城，而不是什么都要自己搞”，当然，很遗憾不是所有的人都能看懂这个事，包括一些资深的人）</li>
</ul>
<ul>
<li>了解 <a href="https://www.pcisecuritystandards.org/" rel="nofollow">处理信用卡的一些规则 </a>. (<a href="http://stackoverflow.com/questions/51094/payment-processors-what-do-i-need-to-know-if-i-want-to-accept-credit-cards-on-m">这里也有一个问题你可以查看一下</a>) （陈皓注：有两上vendor可以帮助你，一个是 <a href="http://www.authorize.net/" rel="nofollow">Authorize.Net</a> 另一个是 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_payflow-pro-overview-outside" rel="nofollow">PayFlow Pro</a>）</li>
</ul>
<ul>
<li>使用 <a href="http://www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt" rel="nofollow">SSL</a>/<a href="http://en.wikipedia.org/wiki/Https" rel="nofollow">HTTPS</a> 来加密传输登录页面或是任可有敏感信息的页面，比如信用卡号等。</li>
</ul>
<ul>
<li>知道如何对付session 劫持。（陈皓注：请参看wikipedia的这<a href="http://en.wikipedia.org/wiki/Session_hijacking" target="_blank">Session Hijacking</a>，）</li>
</ul>
<ul>
<li>避免 <a href="http://en.wikipedia.org/wiki/Cross-site_scripting" rel="nofollow">跨站脚本攻击</a>(XSS)。（陈皓注：参看酷壳站前几天发的《<a title="新浪微博的XSS攻击" href="https://coolshell.cn/articles/4914.html" target="_blank">新浪微博的XSS攻击事件</a>》）</li>
</ul>
<ul>
<li>避免 <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" rel="nofollow">跨站</a><a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" rel="nofollow">伪造</a><a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" rel="nofollow">请求攻击 cross site request forgeries</a> (XSRF).</li>
</ul>
<ul>
<li>保持你的系统里的所有软件更新到最新的patch。</li>
</ul>
<ul>
<li>确保你的数据库连接是安全的。</li>
</ul>
<ul>
<li>确保你能了解最新的攻击技术，以及你系统的脆弱处。</li>
</ul>
<ul>
<li>请读一下 <a href="http://code.google.com/p/browsersec/wiki/Main" rel="nofollow">The Google Browser Security Handbook</a>.</li>
</ul>
<ul>
<li>请读一下 <a href="http://rads.stackoverflow.com/amzn/click/0470170778" rel="nofollow">The Web Application Hacker&#8217;s Handbook</a>.</li>
</ul>
<ul>
<li>（陈皓注：之前本站的“<a title="一些文章资源和趣闻" href="https://coolshell.cn/articles/5537.html" target="_blank">一些资源</a>”提到过<a href="https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines" target="_blank">Mozilla的安全编程规范</a>，还有Ruby on Rails的<a href="http://guides.rubyonrails.org/security.html" target="_blank">Web安全的开发教程</a>）</li>
</ul>
<h4><strong>性能</strong></h4>
<ul>
<li>只要需要，请实现cache机制，了解并合理地使用 <a href="http://www.mnot.net/cache_docs/" rel="nofollow">HTTP caching</a> 以及 <a href="http://www.w3.org/TR/html5/offline.html" rel="nofollow">HTML5 Manifest</a>.</li>
</ul>
<ul>
<li>优化页面 —— 不要使用20KB图片来平铺网页背景。（陈皓注：还有很多网页页面优化性的文章，你可以STFG &#8211; Search The Fucking Google一下。如果你要调试的话，你可以使用firebug或是chrome内置的开发人员的工具来查看网页装载的性能）</li>
<li>学习如何 <a title="gzip content" href="http://developer.yahoo.com/performance/rules.html#gzip" rel="nofollow">gzip/deflate 网页</a> (<a href="http://stackoverflow.com/questions/1574168/gzip-vs-deflate-zlib-revisited">deflate 更好</a>).</li>
</ul>
<ul>
<li>把多个CSS文件和Javascript文件合并成一个，这样可以减少浏览器的网络连数，并且使用gzip压缩被反复用到的文件。</li>
</ul>
<ul>
<li>学习一下 <a href="http://developer.yahoo.com/performance/" rel="nofollow">Yahoo Exceptional Performance</a> 这个网站上的东西，上面有很多非常不错的改善前端性能的指导，以及 <a href="http://developer.yahoo.com/yslow/" rel="nofollow">YSlow</a> 这个工具。 <a href="http://code.google.com/speed/page-speed/docs/rules_intro.html" rel="nofollow">Google page speed</a> 是另一个用来做性能采样的工具。这两个工具都需要安装 <a href="http://getfirebug.com/" rel="nofollow">Firebug</a> 。</li>
</ul>
<ul>
<li>为那些小的图片使用 <a href="http://alistapart.com/articles/sprites" rel="nofollow">CSS Image Sprites</a>，就像工具条一样。 (参看 &#8220;最小化 HTTP 请求&#8221; ) （陈皓注：把所有的小图片合并成一个图片，然后用CSS把显示其中的一块，这样，这些小图片只用传输一次，酷壳的Wordpress样式的那个RSS订阅列表中的小图标就是这样做的）</li>
</ul>
<ul>
<li>繁忙的网络应该考虑<a href="http://developer.yahoo.com/performance/rules.html#split" target="_blank">把网页的内容分开存放</a>在不同的域名下。（陈皓注：比如有专门的图片服务器——图片相当耗带宽，或是专门的Ajax服务器）</li>
</ul>
<ul>
<li>静态网页 (如，图片，CSS，JavaScript，以及一些不需要访问cookies的网页) 应该放在一个<a href="http://blog.stackoverflow.com/2009/08/a-few-speed-improvements/" target="_blank">不使用cookies</a>的独立的域名下，因为所有在同一个域名或子域名下的cookie会被这个域名下的请求一同发送。另一个好的选择是使用 Content Delivery Network (CDN).</li>
</ul>
<ul>
<li>使用单个页面的HTTP请求数最小化。</li>
</ul>
<ul>
<li>为Javascript使用 <a href="http://code.google.com/closure/compiler/" rel="nofollow">Google Closure Compiler</a> 或是 <a href="http://developer.yahoo.com/yui/compressor/" rel="nofollow">其它压缩工具</a>（陈皓注：压缩Javascript代码可以让你的页面减少网络传输从而可以得到很快的喧染。注意，并不是所有的工具都可以正确压缩Javascript的，Google的这个工具甚至还可以帮你优化你的代码）</li>
</ul>
<ul>
<li>确认你的网站有一个 <code>favicon.ico</code> 文件放在网站的根下，如 <code>/favicon.ico</code>. <a href="http://mathiasbynens.be/notes/rel-shortcut-icon" rel="nofollow">浏览器会自动请求这个文件</a>，就算这个图标文件没有在你的网页中明显说明，浏览器也会请求。如果你没有这个文件，就会出大量的404错误，这会消耗你的服务器带宽。（陈皓注：服务器返回404页面会比这个ico文件可能还大）</li>
</ul>
<h4><strong>SEO (搜索引擎优化)</strong></h4>
<ul>
<li>使用 &#8220;搜索引擎喜欢的&#8221; URL，如：使用 <code>example.com/pages/45-article-title</code> 而不是 <code>example.com/index.php?page=45 </code>(陈皓注：这里的URL是说Wordpress的，后者是默认的)</li>
</ul>
<ul>
<li>如果你的动态页面要使用 <code>#</code> ，那么请把其改成 <code>#!</code> ，而在服务端，你需要处理<code>$_REQUEST["_escaped_fragment_"]</code> 这是Google搜索引擎需要的。换句话说，<code>./#!page=1</code> 会被Google搜索引擎转成 <code>./?_escaped_fragments_=page=1。</code> （陈皓注：通常来说URL中的#后的东西都不会被传到服务器上，所以，为了要让Google可以抓取AJAX的东西，你需要使用#!，而Google会把“#!”转成“_escaped_fragment_”来向服务器发请求，Twitter的大量的链接者是#!的，比如：<a href="https://twitter.com/#!/your_activity">https://twitter.com/#!/your_activity</a>）。另外，用户也许会使用Firefox 或 Chromium， <code>history.pushState({"foo":"bar"}, "About", "./?page=1");</code> 是一个很不错的命令。所以，就算是我们的地址栏上的地址改变了，页面也不会重新装载。这可以让你使用 <code>?</code> 而不是 <code>#!</code> 也能无刷地保住当前的动态的页面，这可以让AJAX的请求被浏览器记住。</li>
</ul>
<ul>
<li>别使用 &#8220;click here&#8221; 这样的链接。这样一来，无法SEO，而且对于一些需要使用读屏人来说很不友好（陈皓注：关于读屏软件，可参看本站的“<a title="如果你看不见你还能编程吗？" href="https://coolshell.cn/articles/5514.html" target="_blank">如果看不见你还能编程吗</a>”）</li>
</ul>
<ul>
<li>做一个 <a href="http://www.sitemaps.org/" rel="nofollow">XML sitemap</a>，并放在网端的根下 <code>/sitemap.xml</code>. （陈皓注：这个文件可以让搜索引擎了解你的网站图）</li>
<li>当你有多个URL指向同一个网页的使用，使用 <a href="http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html" rel="nofollow"><code>&lt;link rel="canonical" ... /&gt;</code></a> 你可以使用 <a href="http://www.google.com/webmasters/" rel="nofollow">Google Webmaster Tools</a> 来查看相关的问题。</li>
</ul>
<ul>
<li>使用 <a href="http://www.google.com/webmasters/" rel="nofollow">Google Webmaster Tools</a> 和 <a href="http://siteexplorer.search.yahoo.com/" rel="nofollow">Yahoo Site Explorer</a>.</li>
</ul>
<ul>
<li>安装 <a href="http://www.google.com/analytics/" rel="nofollow">Google Analytics</a>  (或是别的开源的网站分析工具，如： <a href="http://piwik.org/" rel="nofollow">Piwik</a>).</li>
</ul>
<ul>
<li>了解 <a href="http://en.wikipedia.org/wiki/Robots_exclusion_standard" rel="nofollow">robots.txt</a> 和搜索引擎爬虫是如何工作的。</li>
</ul>
<ul>
<li>重定向请求 (使用 <code>301 重定向网站</code>) ，如果你要把 <code>www.example.com</code> 定向到 <code>example.com</code>(或是其它的变更) 这样可以防止Google的rank因为域名的变化发生改变。（陈皓注：301重定向一般用作域名变更）</li>
</ul>
<ul>
<li>知道并不是所有的爬虫都是好的，有些爬虫的行为并不好。（陈皓注：比如向你的网站发大量的请求导致服务器性能低下）</li>
</ul>
<ul>
<li>如果你有一些非文本的内容需要在 Google&#8217;s sitemap  中，比如视频什么的。<a href="http://stackoverflow.com/questions/72394/what-should-a-developer-know-before-building-a-public-web-site#167608">Tim Farley的答案</a>，可以让你看到很多有价值的东西。</li>
</ul>
<h4><strong>技术</strong></h4>
<ul>
<li>理解什么是 <a href="http://www.ietf.org/rfc/rfc2616.txt" rel="nofollow">HTTP</a> 比如 GET, POST, sessions, cookies等，了解什么是 &#8220;stateless&#8221; 无状态。</li>
</ul>
<ul>
<li>让你的 <a href="http://www.w3.org/TR/xhtml1/" rel="nofollow">XHTML</a>/<a href="http://www.w3.org/TR/REC-html40/" rel="nofollow">HTML</a> 和 <a href="http://www.w3.org/TR/CSS2/" rel="nofollow">CSS</a> 符合 <a href="http://www.w3.org/TR/" rel="nofollow">W3C 规范</a>，并确认他们都是 <a href="http://validator.w3.org/" rel="nofollow">合格的</a>。我们的目标是避免浏览器的 “quirks mode”，并且可以让其更容易地能和非标准的浏览器工作，比如读屏器或移动设备。</li>
</ul>
<ul>
<li>理解浏览器是怎么处理 JavaScript 的。（陈皓：你会看到有些Javascript代码在页面上前面，有些则是在后面，所以你需要对其了解清楚为什么是这样）</li>
</ul>
<ul>
<li>了解浏览器是怎么装载 JavaScript，CSS和其它资源的，了解其对视觉上的影响。（陈皓注：10年前我做网页的时候因为HTML还很弱，所以只能使用table来布局，使用table布局的问题就是整个table读完后页面才会显示，用户的视觉体验并不好）。在某些情况下，你可能需要<a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_5.html" target="_blank">把你的脚本放在页面的后面</a>。</li>
</ul>
<ul>
<li>理解 JavaScript 的 sandbox 是怎么怎么工作的，尤其是你想使用iframes。</li>
</ul>
<ul>
<li>请注意 JavaScript 可能会被禁止，这样会让你的AJAX失效。就算是大多数用户都开启了Javascript功能，但是也可能在一些情况下脚本是不被运行的，比如移动终端上，搜索引擎抓网页的时候也并不会执行你的脚本。</li>
</ul>
<ul>
<li>学习 <a href="http://www.bigoakinc.com/blog/when-to-use-a-301-vs-302-redirect/" rel="nofollow">301 和 302 转向的区别</a> (这也是一个SEO的问题).</li>
</ul>
<ul>
<li>尽可能多地学习你的部署平台。（比如：操作系统，Web Server：Apache/Nginx，防火墙，数据库，等等）</li>
</ul>
<ul>
<li>考虑使用一个 <a href="http://stackoverflow.com/questions/167531/is-it-ok-to-use-a-css-reset-stylesheet">Reset Style Sheet</a>.</li>
</ul>
<ul>
<li>考虑使用 JavaScript 框架(如： <a href="http://jquery.com/" rel="nofollow">jQuery</a>, <a href="http://mootools.net/" rel="nofollow">MooTools</a>, <a href="http://www.prototypejs.org/" rel="nofollow">Prototype</a>, <a href="http://dojotoolkit.org/" rel="nofollow">Dojo</a> 或 <a href="http://developer.yahoo.com/yui/3/" rel="nofollow">YUI 3</a>)，它们会很好的兼容于不同的浏览器。（陈皓注：强烈推荐你看一下本站的<a title="开源中最好的Web开发的资源" href="https://coolshell.cn/articles/4795.html" target="_blank">开源中最好的WEB开发资源</a>一文）</li>
</ul>
<ul>
<li>把视觉效果和JS框架合在一起讨论，考虑使用一个Service，如：<a href="http://code.google.com/apis/libraries/devguide.html" rel="nofollow">Google Libraries API</a> 来装载框架，这样可以让浏览器可能早就把这个JS框架已经cache了而不需要再从你的网站上下载了。</li>
</ul>
<h4><strong>Bug fixing</strong></h4>
<ul>
<li>明白你会花20%的时间写代码，而80%的时候在维护，所以你要小心编码。（陈皓注：参看本站的“<a title="多些时间能少写些代码" href="https://coolshell.cn/articles/5686.html" target="_blank">多些时间可以少些代码</a>”一文）</li>
</ul>
<ul>
<li>设计一个好的错误报告机制。</li>
</ul>
<ul>
<li>设计一个入口可以让人们联系到你并给你建议和批评。</li>
</ul>
<ul>
<li>为你开发的东西形成文档，这样可以让后来的人容易维护你的软件和系统。</li>
</ul>
<ul>
<li>频繁备份（也可确保你的这些备份功能正常） <a href="http://stackoverflow.com/questions/72394/what-should-a-developer-know-before-building-a-public-web-site#73970">Ed Lucas 的回答</a> 有一些忠告。你还需要有一个恢复策略，而不只是一个备份策略。</li>
</ul>
<ul>
<li>使用一个版本控制系统来保存你的代码，如： <a href="http://subversion.apache.org/" rel="nofollow">Subversion</a> 或 <a href="http://git-scm.org/" rel="nofollow">Git</a>.</li>
</ul>
<ul>
<li>别忘了做Acceptance Testing，使用 <a href="http://seleniumhq.org/" rel="nofollow">Selenium</a> 能帮到你。</li>
</ul>
<ul>
<li>确保你有足够的日志，你可以使用 log4j, log4n 或 log4r。如果出了问题，这是可以让你快速找到问题的方式。</li>
</ul>
<ul>
<li>当你写日志的时候，确保你记录了你捕获了处理和未处理异常。报告和分析日志可以让你知道你网站的问题。</li>
</ul>
<p>这里有多的东西被省略了，并不是因为那些可能不是有帮助的答案，而是因为那些东西都太细节了，超出了这个问题的范围，因为这本来就是一个Web开发需要了解东西的Overview。我想你可以去看一下其它人的答案，我有时间，我也会补充别人的答案进来。请随意编辑这个答案，因为可能有些东西忘了，也有可能有些东西不对。</p>
<p style="text-align: left;">（全文完）</p>
<p><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" id="wp_rp_first"><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2018/05/300x262-150x150.jpg" alt="程序员练级攻略（2018)  与我的专栏" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_title">程序员练级攻略（2018)  与我的专栏</a></li><li ><a href="https://coolshell.cn/articles/18094.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/08/enable-https-banner-150x150.png" alt="如何免费的让网站启用HTTPS" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18094.html" class="wp_rp_title">如何免费的让网站启用HTTPS</a></li><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/11021.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2014/02/Github-Security-150x150.png" alt="从“黑掉Github”学Web安全开发" width="150" height="150" /></a><a href="https://coolshell.cn/articles/11021.html" class="wp_rp_title">从“黑掉Github”学Web安全开发</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/6043.html">Web开发中需要了解的东西</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/6043.html/feed</wfw:commentRss>
			<slash:comments>150</slash:comments>
		
		
			</item>
		<item>
		<title>图片搜索引擎优化Checklist</title>
		<link>https://coolshell.cn/articles/1528.html</link>
					<comments>https://coolshell.cn/articles/1528.html#respond</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Sun, 11 Oct 2009 03:17:01 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[技术读物]]></category>
		<category><![CDATA[Checklist]]></category>
		<category><![CDATA[SEO]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=1528</guid>

					<description><![CDATA[<p>今天，专业的搜索引擎优化SEO（Search Engine Optimizers）会让你的网页或文章能更多得被搜索并访问到。而图片的搜索优化则是这项技术中非常特...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/1528.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/1528.html">图片搜索引擎优化Checklist</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script></p>
<p style="font-size: 12px; font-family: Arial, Helvetica, sans-serif;">今天，专业的搜索引擎优化SEO（Search Engine Optimizers）会让你的网页或文章能更多得被搜索并访问到。而图片的搜索优化则是这项技术中非常特别的一部分，它可以让你的图片更容易地被人搜索到，比如：艺术图片，服务设计，或是家具等等。相信大家都知道图片远比文字更有吸引力，这是因为我们都知道——“一图胜千言”。</p>
<p style="font-size: 12px; font-family: Arial, Helvetica, sans-serif;"><a href="https://coolshell.cn/wp-content/uploads/2009/10/seo-cartoon.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-1529" title="Image SEO" src="https://coolshell.cn/wp-content/uploads/2009/10/seo-cartoon.jpg" alt="Image SEO" width="490" height="272" srcset="https://coolshell.cn/wp-content/uploads/2009/10/seo-cartoon.jpg 490w, https://coolshell.cn/wp-content/uploads/2009/10/seo-cartoon-300x167.jpg 300w, https://coolshell.cn/wp-content/uploads/2009/10/seo-cartoon-360x200.jpg 360w, https://coolshell.cn/wp-content/uploads/2009/10/seo-cartoon-486x270.jpg 486w" sizes="(max-width: 490px) 100vw, 490px" /></a></p>
<p>在搜索引擎的世界里，有一组有限的因素决定着图片的位置。下面是一个Checklist可以让你把你的图片搜索优化做得更好。</p>
<p><span id="more-1528"></span></p>
<ul style="list-style-image: url(http://www.webceo.com/newsletter/images/new_s.png); text-align: justify;">
<li>首先，你的图片应该是你的网页的一部分，他们使用了相同的样式。例如：页面的Title，head和Body文本必需和图片一样告诉访问者相同的故事。</li>
<li>在你的服务器上创建一个Images的目录，把你的图片都保存在那里。并且确认搜索引擎可以index这个目录。</li>
<li>在图片的文件名上使用描述性关键字，使用连字符号分隔关键字，千万不要使用下划线。</li>
<li>为图片的HTML中&lt;image&gt;标识中的alt属性提供一个简短的描述，你可以认为这是图片的tag，千万不要在alt属性中放入太多的关键字，就算是这些关键字都是相关的。</li>
<li>可以考虑使用一个短的文本来设置&lt;image&gt;的title属性，其中可以包含关键字。</li>
<li>在图片的周围可以配上详细的说明来描述这个图片。</li>
<li>如果你的图片有链接，那么，其链接文本对于图片搜索的rank是相当有用的。</li>
<li>另一方面，如果你的有其它的页面链接到了某一有重要图片的页面，那么，请创建 keyword-rich 链接文本到这一网页。</li>
<li>尽量使用高分辨率的图片，如果可能的话，提供不同分辨率的图片。</li>
<li>避免在Javascript里设置“点击看大图”的链接，Javascript会让搜索引擎导致难以索引的问题。</li>
<li>检查你图片的缩略图尺寸。缩略图应该到少能让人看清是什么，不然，就算是搜索位置靠前，人们也不会点击。</li>
<li>把照片存成 .JPG 文件，而其它简单的图片则存成 .GIF文件。搜索引擎会试图把GIF文件认为是256色的，而JPG是真彩色的。</li>
<li>经常更新你你的图片，因为这是搜索引擎会经常关临并给高分的依据。</li>
<li>另外，最好在你你的图片上加上水印，这样可以让人们对你的网站增加印象。但水印要恰到好处，不然反而令人生厌。</li>
</ul>
<p>文章：<a href="http://www.webceo.com/newsletter/2009/081009.html" target="_blank">来源</a></p>
<p><!-- InstanceEndEditable --><script type="text/javascript"></script><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/30.jpg" alt="Web开发中需要了解的东西" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_title">Web开发中需要了解的东西</a></li><li ><a href="https://coolshell.cn/articles/4811.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/0.jpg" alt="软件真的好难做啊" width="150" height="150" /></a><a href="https://coolshell.cn/articles/4811.html" class="wp_rp_title">软件真的好难做啊</a></li><li ><a href="https://coolshell.cn/articles/9.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2009/03/11-150x150.jpg" alt="你应该知道的20个Ajax技术(11-20)" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9.html" class="wp_rp_title">你应该知道的20个Ajax技术(11-20)</a></li><li ><a href="https://coolshell.cn/articles/6731.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/closure-150x150.png" alt="理解Javascript的闭包" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6731.html" class="wp_rp_title">理解Javascript的闭包</a></li><li ><a href="https://coolshell.cn/articles/3356.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/27.jpg" alt="五个免费开源的数据挖掘软件" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3356.html" class="wp_rp_title">五个免费开源的数据挖掘软件</a></li><li ><a href="https://coolshell.cn/articles/1835.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/28.jpg" alt="IE6/IE7 0day 漏洞" width="150" height="150" /></a><a href="https://coolshell.cn/articles/1835.html" class="wp_rp_title">IE6/IE7 0day 漏洞</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/1528.html">图片搜索引擎优化Checklist</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/1528.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
