Facebook图形api JSONP格式,第一行中的/ * * /是什么意思? [英] Facebook graph api JSONP format , what does the /* */ in first line signify?
问题描述
我注意到一个空的评论块在JSONP输出返回由Facebook图表api
所有的方法。
I noticed an empty comment block in JSONP output returned by facebook graph api for all methods.
我所呼吁的URL:
https://graph.facebook.com/NUMERIC_FACEBOOK_ID/friends?access_token=ACCESS_TOKEN_STRING&callback=theGreatFunction
JSONP输出是:
/**/ theGreatFunction({
"data": [
{
"name": "First Friend",
"id": "XXXX"
},
{
"name": "Second Friend",
"id": "XXXXXX"
},
........
c>之前的回调函数表示?
它有一个特殊的目的吗?它是否修复任何已知的javascript getcha?
My question is : What does the empty comment block /* */
before the callback function signify ?
Does it have a peculiar purpose ? Does it fix any known javascript gotcha ?
推荐答案
p>我们添加了这一点,以防止第三方站点绕过其中的内容类型的攻击通过这样做:
We added this to protect against an attack where a third party site bypasses the content-type of the response by doing:
<object type="application/x-shockwave-flash"
data="http://graph.facebook.com?callback=[specifically crafted flash bytes]">
</object>
Google做类似的事情,除了使用// ... + \\\
(例如 http://www.google .com / calendar / feeds / developer-calendar @ google.com / public / full?alt = json& callback = foo )
Google does something similar, except they use //... + \n (e.g. http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json&callback=foo)
这篇关于Facebook图形api JSONP格式,第一行中的/ * * /是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!