Ramalingam Perumal
Ramalingam Perumal

Reputation: 1427

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

But I want to Share the Image,URL with description on facebook. 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>

Upvotes: 1

Views: 1320

Answers (2)

andyrandy
andyrandy

Reputation: 74014

About the main error: 'your site url' is not a link, it´s a simple text. Use an actual link.

Also, remove the "message" parameter, because that one does not even exist. 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...

...and read the docs about the picture: "The picture must be at least 200px by 200px" - your picture is smaller

...and always use the asynchronous way to include the JavaScript SDK. Don´t forget to initialize the JavaScript SDK with your App ID. 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/

Upvotes: 1

Ramalingam Perumal
Ramalingam Perumal

Reputation: 1427

It will be run after Initiate my 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>

Upvotes: 0

Related Questions