为什么一些主要的网站使用无效的HTML? [英] Why do some major websites use invalid HTML?

查看:123
本文介绍了为什么一些主要的网站使用无效的HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到许多网站,甚至谷歌和一些银行网站,都写得很差,没有引用属性值,或者使用字符(如&符号)在链接中没有正确转义。换句话说,许多人使用不会验证的标记。



我很好奇他们的理由。 HTML有简单的规则,它们似乎并不符合这些规则,这实在令人难以置信。或者他们使用只是吐出代码的程序?

解决方案

大多数人都基本上得到了正确的答案 - —当你每天服务一个页面十亿次时,规则是不同的。字节开始变得重要,而目前的压缩水平清楚地表明Google关心节省带宽。

几点:$ b​​
$ b一个人暗示Google节省带宽的理由是财务。不太可能。即使在Google搜索结果页面上每天节省几TB的资源,相比之下,它们的所有属性总和也是下降的:Youtube,Blogger,地图,Gmail等。更有可能的是Google希望它的搜索结果页面,特别是要尽可能快地加载尽可能多的设备。是的,字节在网页每天载入十亿次时很重要,但字节在您的用户在撒哈拉沙漠中使用卫星电话并努力获得1kbps时也很重要。



二,XHTML的编纂标准等等与1994年以来所有浏览器实际工作的事实标准是不同的。这里,Google的规模很重要,因为大多数Web开发人员都很乐意忽略对于谷歌来说,任何占用户不到0.1%的麻烦浏览器,即0.1%可能是50万人。他们很重要。所以他们的搜索结果页面应该可以在IE 5.5上运行。这就是他们仍然在许多高价值页面上使用表格进行布局的原因 - 它仍然是在大量浏览器上正常工作的布局。



作为锻炼,而在谷歌的实习生中,我写了一个完全符合Google搜索结果页面的XHTML / CSS版本,并将其展示出来。最终问题出现了 - 为什么我们要服务这种大杂烩HTML?我们是不是应该把web开发社区引向标准?我得到的答案几乎是上面的第二点。 Google DOES遵循一个标准 - 不是网络乌托邦这种不可能很好的标准,而是这种必须工作,绝对无处不在的标准。


I noticed that many websites, even Google and some banking sites, have poorly-written HTML with no quotes around the values of attributes, or using characters such as ampersands not escaped correctly in links. In other words, many use markup that would not validate.

I am curious about their reasons. HTML has simple rules and it is just mind-boggling that they don't seem to follow those rules. Or do they use programs that just spit out the code?

解决方案

Most people have gotten the answer basically right — that the rules are different when you serve a page a billion times a day. Bytes begin to matter, and the current level of compression clearly shows that Google is concerned with saving bandwidth.

A few points:

One, people are implying that Google's reasons for saving bandwidth are financial. Unlikely. Even a few terabytes a day saved on the Google search results page is a drop in the bucket compared to the sum of all their properties: Youtube, Blogger, Maps, Gmail, etc. Much more likely is that Google wants its search results page, in particular, to load as quickly as possible on as many devices as possible. Yes, bytes matter when the page is loaded a billion times a day, but bytes also matter when your user is using a satellite phone in the Sahara and struggling to get 1kbps.

Two, there is a difference between the codified standards of XHTML and the like, and the de-facto standard of what actually works in every browser ever made since 1994. Here, Google’s scale matters because, where most web developers are happy to ignore any troublesome browser that accounts for less than 0.1% of their users, for Google, that 0.1% is perhaps a half million people. They matter. So their search-results page ought to work on IE 5.5. This is the reason they still use tables for layout on many high-value pages – it’s still the layout that "just works" on the greatest number of browsers.

As an exercise, while an intern at Google, I wrote a perfectly compliant XHTML/CSS version of Google’s search result page and showed it around. Eventually the question came up – why are we serving such hodge-podge HTML? Shouldn’t we be leading the web dev community towards standards? The answer I got was pretty much the second point above. Google DOES follow a standard – not the wouldn’t-it-be-nice standards of web utopia, but the this-has-to-work-absolutely-everywhere standard of reality.

这篇关于为什么一些主要的网站使用无效的HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆