简体   繁体   English

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

[英]How do I debug Facebook JavaScript api errors on my site?

I am adding a link to my site which will allow users to share what happened on the page on their Facebook wall. 我正在添加一个链接到我的网站,这将允许用户在Facebook墙上分享页面上发生的事情。

To do this, I am utilizing the Facebook Javascript API. 为此,我正在使用Facebook Javascript API。 I have the following code in my head. 我头脑中有以下代码。

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

Later in the body, I am calling the code to publish to the user's stream. 在后面的正文中,我调用代码发布到用户的流。

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) {
           }
         );

    } 

When the user clicks the "share" link, a facebook window comes up, but there is only a text error. 当用户单击“共享”链接时,会出现一个Facebook窗口,但只有文本错误。 "An error occurred. Please try again later." “发生了一个错误。请稍后重试。” is all that is shown, along with the url of https://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,%22description%22:%22I%20just%20made%20a%20reservation%20at%20Harrah's%20Metropolis%20online.%20Guaranteed%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=Tell%20your%20friends%20about%20your%20getaway 就是这一切,以及https://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,%22description%22:%22I%20just%20made%20a%20reservation%20at%20Harrah's%20Metropolis%20online.%20Guaranteed%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=Tell%20your%20friends%20about%20your%20getaway的网址。 https://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,%22description%22:%22I%20just%20made%20a%20reservation%20at%20Harrah's%20Metropolis%20online.%20Guaranteed%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=Tell%20your%20friends%20about%20your%20getaway https://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,%22description%22:%22I%20just%20made%20a%20reservation%20at%20Harrah's%20Metropolis%20online.%20Guaranteed%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=Tell%20your%20friends%20about%20your%20getaway . https://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,%22description%22:%22I%20just%20made%20a%20reservation%20at%20Harrah's%20Metropolis%20online.%20Guaranteed%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=Tell%20your%20friends%20about%20your%20getaway

How in the world do I troubleshoot this issue? 我是如何解决这个问题的? I don't see any javascript errors, and I don't know where any errors would show up. 我没有看到任何javascript错误,我不知道哪里会出现任何错误。 Any help would be appreciated to get my past this issue. 任何帮助将不胜感激我的过去这个问题。 "An Error Occured, please try again later" isn't really helping me at all. “发生错误,请稍后再试”对我来说并没有真正帮助我。

It seems this javascript lib is out of date :) Yes may be because this question just celebrate his first birthday. 看来这个javascript lib已经过时了:)是的可能是因为这个问题只是庆祝他的第一个生日。 The stream.publish will disapear shortly. stream.publish很快就会消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM