为什么Twitter和Google API文档不会在网址中对连字符进行编码? [英] Why doesn't Twitter and Google API documentation encode ampersands in URLs?
问题描述
我已阅读我应该将我的&号码编码为& amp;
不过,众多代码示例来自受尊敬的公司,不知何故忘记这么做
I have read I should encode my ampersands as &
in HTML.
However numerous code samples from respected companies somehow forget to do this.
只是几个例子:
Google网页字体示例代码:
<link href='http://fonts.googleapis.com/css?family=PT+Sans&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
Google地图文档:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&language=ja">
Twitter Anywhere 官方教程:
<script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&v=1" type="text/javascript"></script>
在链接中不是转义&符号有什么真正的好处吗? >
这是关于浏览器的怪癖吗?这只是文档中的错误吗?
Is there any real benefit from not escaping ampersand in links?
Is this related to browser quirks? Is this just a mistake in documentation?
尊敬的回答者,请确保您回答了正确的问题。
Dear answerers, please make sure you're answering the right question.
我知道我根据规范转义符号。我也知道为什么机制是第一个发明的。我不是询问此问题。我的问题是:
I know I should escape ampersands per spec. I also know why the mechanism was invented in the first place. I'm not asking about this. My question is:
有尊敬的公司有没有原因 API文档经常违反这条规则? >
Is there a reason API documentation by respectable companies often violates this rule?
推荐答案
链接中没有转义&符号有什么真正的好处吗? / p>
Is there any real benefit from not escaping ampersand in links?
它会储存几个按键。
这是与浏览器怪癖相关吗?
Is this related to browser quirks?
否
在文档中有错误吗?
Is this just a mistake in documentation?
是
有尊敬的公司有API的文档是否有理由经常违反这条规则?
Is there a reason API documentation by respectable companies often violates this rule?
无知和/或懒惰。浏览器执行错误恢复,所以他们不会注意到错误或他们不在乎。文档可能不是由他们最好的专家写的。
Ignorance and/or laziness. Browsers perform error recovery so they either don't notice the errors or they don't care. The documentation probably isn't written by their best experts.
这篇关于为什么Twitter和Google API文档不会在网址中对连字符进行编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!