我正在尝试添加Google Maps API脚本:
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>
问题是&符号导致XML解析错误。 如果我这样做:
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>
它是逐字逐句返回的。
知道如何在结果页面中获取预期的脚本标记吗?
I'm trying to include the Google Maps API script:
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>
The problem is that the ampersand character causes an XML parsing error. If I do this:
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>
it is returned verbatim.
Any idea how to get the intended script tag in the resulting page?
最满意答案
问题是&符号导致XML解析错误。 如果我这样做:
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>它是逐字逐句返回的。
它不应该。 这完全有效。 更重要的是,根据HTML规范要求使用& 在任何HTML元素的href和src属性中分隔查询字符串中的多个参数。 您的逐字问题是由其他原因引起的。
The problem is that the ampersand character causes an XML parsing error. If I do this:
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>it is returned verbatim.
It shouldn't. It's perfectly valid. Even more, it's required as per the HTML spec to use & to separate multiple parameters in query strings in any HTML element's href and src attribute. Your verbatim problem is caused by something else.
更多推荐
script>,><,<script,脚本,script,电脑培训,计算机培训,IT培训"/> <meta
发布评论