簡體   English   中英

Facebook上的錯誤,API錯誤代碼:100,API錯誤描述:無效參數,錯誤消息:鏈接URL格式不正確

[英]Error on Facebook, API Error code: 100, API error description: invalid parameter, Error message: link URL is not properly formatted

我正在為Facebook開發應用程序。 我正在使用javascript並嘗試在fb上分享帖子時收到錯誤消息(完全如標題部分所示),並顯示錯誤。

但我想在Facebook上分享圖像,URL和描述。 我的代碼如下:

   <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="http://connect.facebook.net/en_US/all.js"></script>

<script type="text/javascript">
    $(document).ready(function(){
        $('#share_button').click(function(e){               
            e.preventDefault();
            FB.ui(
            {
                method: 'feed',
                name: 'Ramalingam',
                link: 'http://temp.pickzy.com/ccc/index.php',
                picture: 'http://temp.pickzy.com/ccc/images/1.PNG',
                caption: 'Image caption name',
                description: 'This is description'              
            });
        });
    });
</script>


<div class="share">
    <a id="share_button" href=""><img src="image/fb_share.jpg" alt="" /></a>
</div>

關於主要錯誤: 'your site url'不是一個鏈接,而是一個簡單的文本。 使用實際鏈接。

另外,刪除“ message”參數,因為該參數甚至不存在。 您無法預填該消息-這是不可能且不允許的,因為您可以閱讀平台政策

...並使用真實網址,而不是localhost ...

...並閱讀有關圖片的文檔:“圖片必須至少為200px x 200px”-您的圖片較小

...並且始終使用異步方式來包含JavaScript SDK。 不要忘記使用您的App ID初始化JavaScript SDK。 下面是一個示例:

window.fbAsyncInit = function() {
    FB.init({
        appId      : 'your-app-id',
        xfbml      : true,
        version    : 'v2.5'
    });
};

(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/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

來源: http//www.devils-heaven.com/facebook-javascript-sdk-login/

將在啟動我的FB app_Id后運行:

 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
    <script src="http://connect.facebook.net/en_US/all.js"></script>

   <div id="fb-root"></div>
    <script>
        window.fbAsyncInit = function() {
            FB.init({appId: '1500007870291234', status: true, cookie: true,
            xfbml: true});
        };
        (function() {
            var e = document.createElement('script'); e.async = true;
            e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
        }());
    </script>


    <script type="text/javascript">
        $(document).ready(function(){
            $('#share_button').click(function(e){
                e.preventDefault();
                FB.ui(
                {
                    method: 'feed',
                    name: 'Ramalingam',
                    link: 'http://temp.pickzy.com/ccc/',
                    picture: 'http://temp.pickzy.com/ccc/images/1.PNG',
                    caption: 'This is the content of the "caption" field.',
                    description: 'This is the content of the "description" field, below the caption.'                       
                });
            });
        });
    </script>


    <div class="share">
        <a id="share_button" class='share-button' href=""><img src="image/fb_share.jpg" alt="" /></a>
    </div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM