Facebook API "invalid version specified"

Viewed 4625

The Facebook API login "quickstart" page says to put the following code in your page:

<script>
    window.fbAsyncInit = function() {
        FB.init({
            appId      : '{your-app-id}',
            cookie     : true,
            xfbml      : true,
            version    : '{latest-api-version}'
        });
        FB.AppEvents.logPageView();
    };

    (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'));
</script>

App ID is easy, but what on earth is it expecting for {latest-api-version}? I've tried both '2.1' and '2' and both values throw "invalid version specified" to the console.

2 Answers

use: "v5.0" NOT "{v5.0}"

eg:

    FB.init({
        appId      : 'xxxxxxxx',
        cookie     : true,
        xfbml      : true,
        version    : 'v5.0'
    });
Related