简体   繁体   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

I am working on developing apps for Facebook. 我正在为Facebook开发应用程序。 I am using javascript and I got the error message (exactly as shown in title section) when I attempt to share the post on fb the error is shown. 我正在使用javascript并尝试在fb上分享帖子时收到错误消息(完全如标题部分所示),并显示错误。

But I want to Share the Image,URL with description on facebook. 但我想在Facebook上分享图像,URL和描述。 The code I have is below: 我的代码如下:

   <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>

About the main error: 'your site url' is not a link, it´sa simple text. 关于主要错误: 'your site url'不是一个链接,而是一个简单的文本。 Use an actual link. 使用实际链接。

Also, remove the "message" parameter, because that one does not even exist. 另外,删除“ message”参数,因为该参数甚至不存在。 You can´t prefill the message - it is not possible AND not allowed, as you can read in the platform policy . 您无法预填该消息-这是不可能且不允许的,因为您可以阅读平台政策

...and use a real URL, not localhost... ...并使用真实网址,而不是localhost ...

...and read the docs about the picture: "The picture must be at least 200px by 200px" - your picture is smaller ...并阅读有关图片的文档:“图片必须至少为200px x 200px”-您的图片较小

...and always use the asynchronous way to include the JavaScript SDK. ...并且始终使用异步方式来包含JavaScript SDK。 Don´t forget to initialize the JavaScript SDK with your App ID. 不要忘记使用您的App ID初始化JavaScript SDK。 An example how that would look like: 下面是一个示例:

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'));

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

It will be run after Initiate my FB app_Id: 将在启动我的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