w3c markup validator ampersand (&) error

ⅰ亾dé卋堺 提交于 2019-11-26 17:16:46

问题


Is there any workaround for the w3c validation error for an & present in urls or some other place in HTML markup?
It says:

& did not start a character reference. (& probably should have been escaped as &.)

The ampersand in my case is a part of a url for gravatar thumbnail. This is the problematic part of a url:

c91588793296e2?s=50&d=http%3A%2F%.


回答1:


for each & sign you got write & in your example it would be:

c91588793296e2?s=50&d=http%3A%2F%



回答2:


Use & for literal ampersands, even in URLs.

http://htmlhelp.com/tools/validator/problems.html#amp




回答3:


Replace with &




回答4:


should be:

c91588793296e2?s=50&d=http%3A%2F%.

notice the &

I know it feels wonky, but ampersands have to be encoded as html entities, which are confusingly denoted with ampersands.



来源:https://stackoverflow.com/questions/4441594/w3c-markup-validator-ampersand-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!