【发布时间】:2013-11-02 11:18:38
【问题描述】:
尝试使用 W3C 验证器验证以下 HTML 将引发 3 个错误(截至 2013 年 10 月 30 日):
<!DOCTYPE html>
<head><title>asdf</title></head>
<img src="http://maps.googleapis.com/maps/api/staticmap?zoom=13&size=279x183&markers=50.916780,5.347420&sensor=false" alt="map">
三个错误都是一样的:
& 没有开始字符引用。 (& 可能应该被转义为 &。)
不幸的是,这里符合 W3C 会导致静态地图图像无法渲染。尝试嵌入带有以下 URL 的 img 标记作为其 src 属性的值:
<img src="http://maps.googleapis.com/maps/api/staticmap?zoom=13&size=279x183&markers=50.916780,5.347420&sensor=false">
Google 会返回一个错误,说明:
Google Maps API 服务器拒绝了您的请求。无效的请求。缺少“大小”参数。
为什么 Google 静态地图 API 不支持在查询字符串中包含 &amp; 的有效网址?
【问题讨论】:
标签: url url-encoding google-static-maps