gpt4 book ai didi

javascript - 如何调试我网站上的 Facebook JavaScript api 错误?

转载 作者:行者123 更新时间:2023-12-01 21:51:45 26 4
gpt4 key购买 nike

我正在向我的网站添加一个链接,该链接将允许用户在 Facebook 墙上分享页面上发生的事情。

为此,我使用 Facebook Javascript API。我脑子里有以下代码。

<script src="http://static.ak.fbcdn.net/connect/en_US/core.debug.js" type="text/javascript"></script>

在正文的后面,我将调用代码以发布到用户的流。

window.fbAsyncInit = function() { 
FB.init({
appId: "XXXXXXXXXXX",
status: true,
cookie: true,
xfbml: true,
level : "debug"
});
};
streamPublish = function(){
var session = Session.get('eres_user_data');
var argumentsURL = "";
var confirmFacebookTitle = "";
var confirmFacebookMessage = "";

if (session.promoCode != null && session.promoCode != ""){
argumentsURL = "https://www.totalrewards.com/hotel-reservations/?propcode="+session.propCode+"&promotioncode="+session.promoCode+"view=ratecal&social="+session.propCode+"_tw_eResShare";
confirmFacebookTitle = "It's time to play at "+session.propName+"!";
confirmFacebookMessage = "I just saved "+ confirmationMod_session.savings+" by using the "+confirmationMod_session.promoName+" online at "+confirmationMod_session.propName+"!";
}
else if (session.showHotDeals == "Y"){
argumentsURL = "https://www.totalrewards.com/hotel-reservations/?propcode="+session.propCode+"view=ratecal&showhotdeals=y&social="+session.propCode+"_tw_eResShare";
confirmFacebookTitle = "I booked a smoking hot deal at "+session.propName+"!";
confirmFacebookMessage = "I just made a reservation at "+session.propName+" using the 'Hot Deals Calendar'. Guaranteed lowest rates, and so easy to book. Wish me luck!";
}
else if (session.packageCode != null && session.packageCode != ""){
argumentsURL = "https://www.totalrewards.com/hotel-reservations/?propcode="+session.propCode+"&packagecode="+session.packagecode+"view=ratecal&social="+session.propCode+"_tw_eResShare";
confirmFacebookTitle = "I booked a "+session.packageName+" package deal at "+session.propName+"!";
confirmFacebookMessage = "I just made a reservation at "+session.propName+" online. Guaranteed lowest rates, and so easy to book. Wish me luck!";
}
else{
argumentsURL = "https://www.totalrewards.com/hotel-reservations/?propcode="+session.propCode+"&view=ratecal&social="+session.propCode+"_tw_eResShare";
confirmFacebookTitle = "It's time to play at "+session.propName+"!";
confirmFacebookMessage = "I just made a reservation at "+session.propName+" online. Guaranteed lowest rates, and so easy to book. Wish me luck!";
}
FB.ui(
{
method: 'stream.publish',
display:'dialog',
message: 'test',
attachment: {
name: confirmFacebookTitle,
caption: '',
description: confirmFacebookMessage,
'media': [{
'type': 'image',
'src': 'http://www.caesars.com/images/casinos/'+session.propCode+'MET_alt.png',
'href': argumentsURL
}],
href: argumentsURL
},
action_links: [
{ text: 'Find Rates', href: argumentsURL}
],
user_message_prompt: 'Tell your friends about your getaway.'
},
function(response) {
}
);

}

当用户点击“分享”链接时,会出现一个 Facebook 窗口,但只有一个文本错误。 “发生了一个错误。请稍后重试。”就是显示的全部内容,以及 urlhttps://www.facebook.com/dialog/stream.publish?action_links=[{%22text%22:%22Find%20Rates%22,%22href%22:%22https://www.totalrewards.com/hotel-reservations/%3Fpropcode%3DMET%26view%3Dratecal%26social%3DMET_tw_eResShare%22}]&attachment={%22name%22:%22It's%20time%20to%20play%20at%20Harrah's%20Metropolis!%22,%22caption% 22:%22%22,%22描述%22:%22I%20just%20made%20a%20reservation%20at%20Harrah's%20Metropolis%20online.%20保证%20lowest%20rates,%20and%20so%20easy%20to%20book.% 20Wish%20me%20luck!%22,%22media%22:[{%22type%22:%22image%22,%22src%22:%22http://www.caesars.com/images/casinos/METMET_alt.png% 22、%22href%22:%22https://www.totalrewards.com/hotel-reservations/%3Fpropcode%3DMET%26view%3Dratecal%26social%3DMET_tw_eResShare%22}],%22href%22:%22https://www .totalrewards.com/hotel-reservations/%3Fpropcode%3DMET%26view%3Dratecal%26social%3DMET_tw_eResShare%22}&display=popup&locale=en_US&message=test&next=http://static.ak.fbcdn.net/connect/xd_proxy.php% 23cb%3Df2b8d16234%26relation%3Dopener%26frame%3Df2f644938%26result%3D%2522xxRESULTTOKENxx%2522&sdk=joey&user_message_prompt=告诉%20your%20friends%20about%20your%20getaway

我究竟该如何解决这个问题?我没有看到任何 JavaScript 错误,也不知道错误会出现在哪里。任何帮助我解决这个问题的帮助将不胜感激。 “发生错误,请稍后再试”根本没有真正帮助我。

最佳答案

看来这个 javascript 库已经过时了:) 是的,可能是因为这个问题只是庆祝他的第一个生日。 Stream.publish 很快就会消失。

关于javascript - 如何调试我网站上的 Facebook JavaScript api 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5035806/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com