HTML超链接地址中 "&" 符号可能导致的问题


======================================================
注:本文源代码点此下载
======================================================

html超链接地址中 "&" 符号可能导致的问题

众所周知, "&" 符号在html中要用实体,表示为 "&"。那么,超链接中的"&"符号呢?

当我们用 http://validator.w3.org/ 验证html文件的格式的时候, 可以明确的得到答复:

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

没有通过验证.

在 http://www.htmlhelp.com/tools/validator/problems.html#amp, 上我们可以到找答案:

another common error occurs when including a §ion=2©=3&lang=en">...

this example generates an error for "unknown entity section" because the "&" is assumed to begin an entity reference. browsers often recover safely from this kind of error, but real problems do occur in some cases. in this example, many browsers correctly convert ©=3 to ©=3, which may cause the link to fail. since 〈 is the &section=2&copy=3&lang=en">...

note that replacing & with & is only done when writing the section=2©=3" 解释成 section=2@=3". 那么最终用户点击这个链接,打开的页面路径就是错的.服务器端接收到的 section的值不是2, 而是 2@=3.当url中的参数名以html实体命名时, 都会发生这个错误, 如 〈 © 等.这个情况出现在包括ie6-8(9?)以及opera在内的浏览器中.标签: html, w3c validator, w3c验证

绿色通道:好文要顶关注我收藏该文与我联系

posted @ 2011-10-13 23:19 温晚 阅读(252) 评论(0)编辑 收藏


======================================================
在最后,我邀请大家参加新浪APP,就是新浪免费送大家的一个空间,支持PHP+MySql,免费二级域名,免费域名绑定 这个是我邀请的地址,您通过这个链接注册即为我的好友,并获赠云豆500个,价值5元哦!短网址是http://t.cn/SXOiLh我创建的小站每天访客已经达到2000+了,每天挂广告赚50+元哦,呵呵,饭钱不愁了,\(^o^)/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值