首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >urlfetch.fetch在应用程序引擎中的html脚本标记中丢失了内容

urlfetch.fetch在应用程序引擎中的html脚本标记中丢失了内容
EN

Stack Overflow用户
提问于 2010-02-22 18:12:04
回答 1查看 365关注 0票数 2

在我的应用中,当我使用urlfetch.fetch函数来获取指定的url时,我发现对于一些特殊的html代码,我得到的内容是空的。

例如,实际html源代码中的url:http://www.club.cn.sodexo.com/node/5071,代码包括:

代码语言:javascript
复制
<div class="content">
<div style="width: 219px; height: 262px;" id="gmap-auto3map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-auto3map-gmap">Javascript is required to view this map.</div>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.extend(true, Drupal, { settings: { "gmap": { "auto3map":{ "width": "219px", "height": "262px", "zoom": 16, "maxzoom": "17","controltype": "Large", "align": "None", "maptype": "Map", "mtc":"none", "baselayers": { "Map": 1, "Satellite": 1, "Hybrid": 1 },"styles": { "line_default": [ "0000ff", "5", "45", "", "" ],"poly_default": [ "000000", "3", "25", "ff0000", "45" ] },"line_colors": [ "#00cc00", "#ff0000", "#0000ff" ], "behavior":{ "autozoom": true }, "markermode": "0", "id": "auto3map", "latitude":"31.239132", "longitude": "121.483506", "markers": [ { "latitude":"31.239132", "longitude": "121.483506", "markername": "small red","offset": 0, "opts": { "title": "克莉丝汀食品(宁波路店)" }, "text": "\x3cdiv class=\"gmap-popup\"\x3e\x3c/div\x3e" } ] } } } });
/* ]]> */
</script>
</div> 

但是从我通过url fetch得到的:结果是:

代码语言:javascript
复制
<div class="content">
<div style="width: 219px; height: 262px;" id="gmap-auto3map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-auto3map-gmap">Javascript is required view this map.</div>
<script type="text/javascript">
/* <![CDATA[ */
/* ]]> */
</script>

/* <![CDATA[ *//* ]]> */之间的所有javascript代码都被遗漏了,这是如此紧密相连。有人知道问题出在哪里吗?是否有可能解决此问题?

EN

回答 1

Stack Overflow用户

发布于 2011-03-31 11:49:34

也许服务器会根据用户代理插入不同的javascript (即Firefox与Internet Explorer的不同代码),而对于urlfetch的用户代理,服务器会感到困惑,根本不会插入任何javascript。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2310134

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档