使Facebook的图形API与令牌在Internet Explorer中 [英] Making Facebook's Graph API with tokens work in Internet Explorer

查看:103
本文介绍了使Facebook的图形API与令牌在Internet Explorer中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的几个问题,而试图让IE浏览器Facebook的图形API的工作。

I've encountered several issues while trying to get Facebook's Graph API work in IE.

第一个问题是,我得到一个无交通运输拨打电话时 https://graph.facebook.com 。这里的问题是XDomainRequest,并最终通过使用此变通办法解决: HTTPS ://github.com/jaubourg/ajaxHooks/blob/master/src/ajax/xdr.js (我使用jQuery和XDomainRequest是的不支持

The first problem was that I was getting a No Transport when making a call to https://graph.facebook.com. The issue here is XDomainRequest and was eventually solved by using this workaround: https://github.com/jaubourg/ajaxHooks/blob/master/src/ajax/xdr.js (I'm using jQuery and XDomainRequest is not supported)

现在,我有问题是,我收到访问被拒绝,同时打电话到 https://graphs.facebook.com 。一些阅读后,我发现从<一个href="http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx"相对=nofollow>这里是:

Now the problem that I have is that I'm getting "Access is Denied" while making calls to https://graphs.facebook.com. After some reading, I found out from here that:

7)的要求,必须有针对性地相同的方案托管页

7) Requests must be targeted to the same scheme as the hosting page

当然,我正在从电话 HTTP (我的域名),以 HTTPS (graphs.facebook) ,而且违背了上述点#7。

And of course, I was making calls from http (my domain) to https (graphs.facebook), and that goes against the aforementioned point #7.

那么,我第一次尝试是打电话到 http://graphs.facebook.com 来代替,并且工作......但只有当不使用 access_token 在您的要求;我需要有我的道理在所有的请求。

So what I first tried was to make a call to http://graphs.facebook.com instead, and that works...but only when not using an access_token in your request; and I need to include my token in all the requests.

所以,除了购买证书,并把对 HTTPS 我的网站(我不会做),我能做些什么,使成功的Ajax调用域它采用了不同的方案,IE浏览器?

So, apart from buying a certificate and putting my site on https (which I won't do), what can I do to make successful ajax calls to a domain which uses a different scheme in IE?

推荐答案

您AJAX调用必须是一个JSONP类型,而不是一个JSON类型。在JSONP的P是方法来解决问题与IE浏览器。看到这里与JSONP调用Facebook的一个例子。 <一href="http://stackoverflow.com/questions/4669781/howto-get-jsonp-and-facebook-graph-api-to-work">Howto获得JSONP和Facebook图形API的工作?

Your AJAX call must be a JSONP type, not a JSON type. The P in JSONP is the way to get around the issue with IE. See an example here for calling with JSONP to facebook. Howto get JSONP and Facebook Graph API to work?

这篇关于使Facebook的图形API与令牌在Internet Explorer中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆