按下点赞按钮时出现Facebook错误
Facebook error when like button pressed
当点击类似按钮时,我得到了这个。
不安全的JavaScript尝试访问具有URL的帧http://www.facebook.com/dialog/oauth?api_key=248753205242460&app_id=24875320542460&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D9%23cb%3Fedecb848%26origin%3Dhttp%253A%252F%252Flocalhost%252Ff2ad19772%26domain%3Dlocalhost%26relationship%3Parentparent&client_id=24875320542460&display=none&domain=localhost&locale=en_US&原点=1&redirect_uri=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D923cb%3Df99e53428%26origin%3Dhttp%253A%252F%252Flocalhost%252Ff2ad19772%26domain%3Dlocalhost%26relationship%3Parent%26frame%3Df2c40b1914&response_type=令牌%2Signed_request%2Code&sdk=来自具有URL的帧的joeyhttp://www.facebook.com/plugins/like.php?action=like&api_key=24875320542460&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D9%23cb%3Df458cef1c%26origin%3Dhttp%253A%252F%252Flocalhost%252Ff2ad19772%26domain%3localhost%26relationship%3Parent.eparent&配色方案=浅色&extended_socialcontext=false&font=segoe%20ui&href=http%3A%2F%2commercedeveloper.com&layout=标准&locale=en_US&node_type=链接&sdk=joey&show_faces=真&宽度=400#。域、协议和端口必须匹配。不安全的JavaScript尝试访问具有URL的帧https://s-static.ak.facebook.com/connect/xd_arbiter.php?version=9#channel=f2ad19772&origin=http%3A%2F%2localhost&channel_path=%2FDummy%2FBplugin%2Fb.php%3Fb_xd_frage%23x_sig%3Dfe951f208%26,来自具有URL的帧http://www.facebook.com/plugins/like.php?action=like&api_key=24875320542460&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D9%23cb%3Df458cef1c%26origin%3Dhttp%253A%252F%252Flocalhost%252Ff2ad19772%26domain%3localhost%26relationship%3Parent.eparent&配色方案=浅色&extended_socialcontext=false&font=segoe%20ui&href=http%3A%2F%2commercedeveloper.com&layout=标准&locale=en_US&node_type=链接&sdk=joey&show_faces=真&宽度=400#。域、协议和端口必须匹配。
我不知道为什么会出现这个错误,可能是因为检查登录的代码被触发了。。
这是我的html:
<!DOCTYPE html>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
$(document).ready(function(){
FB.init({
appId : '248753205242460', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
window.fbAsyncInit = function() {
console.log('Sdk is loaded');
FB.getLoginStatus(function(response) {
console.log('GEtting logged in status');
if (response.status === 'connected') {
// the user is logged in and has authenticated your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire
var uid = response.authResponse.userID;
console.log('User is connected');
var accessToken = response.authResponse.accessToken;
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
// but has not authenticated your app
console.log('User not authorized');
} else {
// the user isn't logged in to Facebook.
console.log('User inst logged in');
}
});
};
FB.Event.subscribe('edge.create',
function(response) {
console.log('You liked the URL: ' + response.status);
});
});
</script>
</body>
</html>
错误消息Unsafe JavaScript attempt to access frame with URL
和Domains, protocols and ports must match
通常意味着您的http协议有故障。您应该为这些调用使用HTTPS而不是普通的HTTP吗?
当我看到这些错误时,我通常会测试我是否在某个地方丢失了https。。。
还可以看看你的应用程序是否在facebook上的开发者管理面板中设置了所有安全的URL!
我正在使用的另一个事件是"getLoginStatus",它将显示用户是否登录到facebook。。
这本身并不是一个"事件"——它只是一个异步方法,它可以为您获取登录状态。
console.log('FB.getLoginStatus:'+FB.getLogonStatus);
在这一点上,您甚至没有调用该方法——您只是声明了它的名称。(我知道,您以前调用过它,但这个调试输出没有多大意义。)
我想触发边缘。创建
你是如何实现点赞按钮的?如果您使用的是按钮的iframe版本,则不会触发此事件。
[来自评论]我想我需要有自己的应用程序id…这会是原因吗?这是我的脸书名字,而不是数字
当然可以。您的用户名是,而不是应用程序id。
- 使用FB.ui的Facebook Feed对话给出API错误191
- 使用Javascript向ID数组发送通知时出现Facebook访问令牌错误
- JSON3中的Facebook xd_arbiter.php错误
- Facebook JavaScript SDK 检查用户是否为粉丝(错误:指定的版本无效)
- Facebook javascript sdk 基本登录或初始化错误
- Facebook 支付 API - 没有代码的错误
- 未捕获的类型错误:无法调用方法'shift'Chrome中的Facebook JS库为null
- Facebook Web应用程序开发错误
- Facebook发送对话框类型错误
- Facebook共享按钮/history.pushstate/错误的url
- Facebook共享按钮错误
- Facebook Graph API-#4错误-已达到应用程序请求限制
- 按下点赞按钮时出现Facebook错误
- 如何修复重复的Facebook像素ID错误
- Facebook Javascript API调用返回需要appsecret_proff参数的错误,但这是客户端
- Javascript中的语法错误?(尝试动态加载 Facebook JavaScript SDK)
- 来自Facebook错误的FQL查询(“必须是索引列”)
- Facebook“错误2”;在ios上使用Phonegap构建Facebook连接插件
- 我怎样才能纠正这个facebook错误
- Facebook错误时使用多个.js api