我对FB.ui的任何调用都没有跟随任何动作.在Chrome上,如果'display'属性设置为'iframe'或'dialog',则会触发以下错误:
阻止来自原始" https://www.facebook.com "的框架访问具有原始" http://my.domain.com " 的框架.请求访问的帧具有"https"协议,被访问的帧具有"http"协议.协议必须匹配.
Firefox和IE都没有在控制台中显示任何内容,但也没有任何反应.因此,我不太确定这是否是一个真正的XSS问题.为了记录,整个网站都在HTTP上运行,我没有明确指定任何HTTPS查询.
源代码如下:
window.fbAsyncInit = function() {
FB.init({
appId : XXXXXXXXX,
status : true,
cookie : true,
});
FB.Event.subscribe('auth.logout', function(response) {
window.location.reload();
});
window.selectedFacebookFriends = [YYYYYYYYY];
window.inviteFacebookFriends = function() {
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
to = window.selectedFacebookFriends.join(',');
FB.ui({
method: 'apprequests',
message: 'Join ZZZZZZZZZ, it\'s cool there!',
to: to
}, function(response) {});
}
});
}
};
// Load the SDK asynchronously
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) …Run Code Online (Sandbox Code Playgroud) 我曾经能够,但由于某种原因,我使用FB.ui()的所有Facebook Javascript API调用不再适用于我的url为localhost:8080的开发环境.在生产中它工作正常.我有一个开发环境Facebook应用程序,但我只是在其中更改URL.我认为这就是问题所在.我如何拥有允许来自开发和生产环境的FB.ui()调用的Facebook应用程序?这是我在dev中调用FB.UI()时得到的错误:
An error occurred with AppleTree dev. Please try again later.
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
Run Code Online (Sandbox Code Playgroud) 以下是我如何将Facebook Feed Dialog实现到我的页面:
HTML标记:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://opengraphprotocol.org/schema/">
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=***************";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
FB.init({
appId: '***************',
display: 'popup',
status: true,
cookie: true,
xfbml: true,
oauth: true,
method: 'send'
});
Run Code Online (Sandbox Code Playgroud)
发送按钮:
<a onclick="javascript:twitter(this); return false;" href="https://www.facebook.com/dialog/feed?display=popup&app_id=***************&name=<name>&link=<link>&redirect_uri=<uri>">
<div class="fb-container"></div>
</a>
Run Code Online (Sandbox Code Playgroud)
在这里我使用Twitter的弹出脚本因为display:popup不起作用,不知道为什么.
然而,弹出窗口出现,我发送了Feed.但后来我被重定向到redirect_uri.我不想要这个.我只想在单击"发送"或"取消"按钮后关闭弹出窗口.我做了类似于检测按钮是否被点击然后尝试window.close;但没有成功的事情,因为它是一个新窗口(弹出窗口).
有任何想法吗?
我的 Facebook 分享按钮没有选择我的 Django 应用程序上的元标记。我现在正在尝试一个更自定义的函数,但收到错误“无法解析 URL http://localhost:8000/处的对象”。
我尝试了许多不同的方法,但我无法让元标记工作,否则我会收到这个“解析对象”错误。我在 Facebook 应用程序设置中将“ http://localhost:8000/ ”指定为我的站点 URL。我希望用户能够将{{ poll.question }}我的 html 页面中的内容分享到 Facebook ...我哪里出错了?
<meta property="og:url" content="http://localhost:8000/" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Check out this forecast on CASSIE: {{ poll.question }}"/>
<meta property="og:description" content="Join Cassie to forecast this and more! See how accurate you are at \
predicting the future!" />
<meta property="og:image" content="{{MEDIA_URL }}/social/logo_words.png" />
<div class="text-center" id="fb-root">
<div class="btn btn-primary" onclick="fbshare()"></div>
</div>
{% block js %}
<script>
function …Run Code Online (Sandbox Code Playgroud)