Invalid version specified, sharebook share plugin error

I want to use the sharebook plugin for the web application I'm working on, I only need the primary access button. The application uses requirejs to download javascript, so I followed the manual and changed the facebook api url to the one that was found in the code snippets on facebook docs . This does not work, and sdk throws an invalid version specified error. This is what my files look like.

main.js

 require.config({ shim: { 'facebookshare' : { exports: 'FB' } }, paths: { 'facebookshare': "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0" } }); require(['fb']); 

fb.js

 define(['facebookshare'], function(facebook) { document.body.innerHTML += '<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button"></div>'; }); 

What is the best way to enable only sharebook plugin for facebook with requirejs?

I referred to the following questions, but none of them gives a concrete solution. Uninstall error: no version specified and invalid version error .

+37
javascript facebook requirejs facebook-javascript-sdk
Dec 23 '14 at 13:16
source share
4 answers

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

Search error: invalid version specified in sdk.js

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

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



Now an outdated fix ...

... should have done a simple setup and changed the path:

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

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

+82
Feb 18 '15 at 7:23
source share
— -

Consider including the version parameter in the src property, as shown below:

 js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8" 

The default template on How the button for the web is incomplete; when you click on the "Get Code" button, Facebook will create a complete template with the version option enabled.

+45
Nov 22 '15 at 16:52
source share

Minor heads, I had to change

js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1 &amp; version=v2.8";

to

js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1 & version=v2.8";

+3
Jan 24 '17 at 10:27
source share

I ran into this problem when I changed my file from HTTP to HTTPS. The reason was the lack of a specific “HTTP:” or “HTTPS:” in the following code:

 <div class="fb-comments" data-width="100%" data-href="//amazingjokes.com/image/2017-03-17/A_good_sign_for_St__Patricks_day" data-num-posts="5" data-colorscheme="light"> </div> 

usually "//domain.com" copies the scheme we are in, so when you are at htts: //example.com, the link to "//example2.com" will look like " https://example2.com '. For "fb comments" you will need to specify HTTP or HTTPS for the href data.

Also note that ' https://example.com ' according to facebook is a different page than http://example.com '. Therefore, if you upgrade your site for SSL, you will lose all past comments if you change the URL in social plugins from HTTP to HTTPS ... The solution I chose is to use HTTP for all older messages, and HTTPS for all last

0
Mar 20 '17 at 12:42 on
source share



All Articles