开发者

urlfetch.fetch got missed content within script tag of html in app engine

in my app, when I use urlfetch.fetch function to fetch a specified url, I found the content I got is empty for some special html codes.

for example, the url: http://www.club.cn.sodexo.com/node/5071 in real html source, the codes including:

<div class="content">
<div style="width: 219px; height: 262px;" id="gmap-auto3map-gma开发者_JS百科p0" 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> 

but from what I got through url fetch: the result would be:

<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>

All the javascript codes between /* <![CDATA[ */ and /* ]]> */ is missed, which is so wired. Anyone knows the problem? Is it possible to fix this issue?


Perhaps the server inserts different javascript based on the user-agent (ie different code for Firefox verses Internet Explorer), and for urlfetch's user-agent the server gets confused and doesn't insert any javascript at all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜