Invalid version specified, facebook share plugin error

后端 未结 6 1336
广开言路
广开言路 2020-12-30 18:42

I want to use the facebook share plugin for the web app I am working on, I only need the basic share button. The app uses requirejs for loading javascript, so I followed the

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-30 19:00

    I was also getting the following error even when using the standard embed code that Facebook provides.

    Uncaught Error: invalid version specified in sdk.js

    The first thing to check is that you're including the version number in your FB.init call:

    FB.init({
      appId: 'your-app-id',
      xfbml: true,
      version: 'v2.8'
    });
    

    The now-outdated fix...

    ...was to make a simple tweak and changed the path:

    From:   //connect.facebook.net/en_GB/sdk.js  
    To:     //connect.facebook.net/en_GB/all.js
    

    And this fixed the error. Unfortunately I have no idea why. :-(

提交回复
热议问题