title: Facebook javascript sdk basic login or initialization error
body: <p>I have following code mostly copy pasted from <a href="https://developers.facebook.com" rel="nofollow">https://developers.facebook.com</a>. </p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="fb-root"&gt;&lt;/div&gt;
      &lt;button id="fb-auth"&gt;Login&lt;/button&gt;
  
      &lt;script type="text/javascript"&gt;
          var button;
          var userInfo;
  
          window.fbAsyncInit = function() {
              FB.init({ appId: '864702126886557', // your appId
                  status: true,
                  cookie: true,
                  xfbml: true,
                  oauth: true});
  
             showLoader(true);
  
             function updateButton(response) {
                  button       =   document.getElementById('fb-auth');
                  userInfo     =   document.getElementById('user-info');
  
                  if (response.authResponse) {
                      //user is already logged in and connected
                      FB.api('/me', function(info) {
                          login(response, info);
                      });
  
                      button.onclick = function() {
                          FB.logout(function(response) {
                              logout(response);
                          });
                      };
                  } else {
                      //user is not connected to your app or logged out
                      button.innerHTML = 'Login';
                      button.onclick = function() {
                          showLoader(true);
                          FB.login(function(response) {
                              if (response.authResponse) {
                                  FB.api('/me', function(info) {
                                      login(response, info);
                                  });
                              } else {
                                  //user cancelled login or did not grant authorization
                                  showLoader(false);
                              }
                          }, {scope:'email,user_birthday,status_update,publish_stream,user_about_me'});
                      }
                  }
              }
  
              // run once with current status and whenever the status changes
              FB.getLoginStatus(updateButton);
              FB.Event.subscribe('auth.statusChange', updateButton);
          };
  
          (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 = "http://connect.facebook.net/en_US/sdk.js";            
              fjs.parentNode.insertBefore(js, fjs);
              document.getElementById('fb-root').appendChild(js);
          }(document, 'script', 'facebook-jssdk'));
  &lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <p>When I execute this code I get following error:-</p>
  
  <p>Uncaught Error: invalid version specified sdk.js:96 (anonymous function)</p>
  
  <p>Line from sdk.js:96 :-</p>
  
  <p>__d("sdk.ErrorHandling",["ManagedError","sdk.Runtime","sdk.Scribe","sdk.UA","sdk.feature","wrapFunction"],function(a,b,c,d,e,f,g,h,i,j,k,l){b.__markCompiled&amp;&amp;b.__markCompiled();var m=k('error_handling',false),n='';function o(u){var v=u._originalError;delete u._originalError;i.log('jssdk_error',{appId:h.getClientID(),error:u.name||u.message,extra:u});throw v;}function p(u){var v={line:u.lineNumber||u.line,message:u.message,name:u.name,script:u.fileName||u.sourceURL||u.script,stack:u.stackTrace||u.stack};v._originalError=u;if(j.chrome()&amp;&amp;/([\w:./]+.js):(\d+)/.test(u.stack)){v.script=RegExp.$1;v.line=parseInt(RegExp.$2,10);}for(var w in v)(v[w]==null&amp;&amp;delete v[w]);return v;}function q(u,v){return function(){if(!m)return u.apply(this,arguments);try{n=v;return u.apply(this,arguments);}catch(w){if(w instanceof g)throw w;var x=p(w);x.entry=v;var y=ES(Array.prototype.slice.call(arguments),'map',true,function(z){var aa=Object.prototype.toString.call(z);return (/^[object (String|Number|Boolean|Object|Date)]$/).test(aa)?z:z.toString();});x.args=ES('JSON','stringify',false,y).substring(0,200);o(x);}finally{n='';}};}function r(u){if(!u.__wrapper)u.__wrapper=function(){try{return u.apply(this,arguments);}catch(v){window.setTimeout(function(){throw v;},0);return false;}};return u.__wrapper;}function s(u,v){return function(w,x){var y=v+':'+(n||'[global]')+':'+(w.name||'[anonymous]'+(arguments.callee.caller.name?'('+arguments.callee.caller.name+')':''));return u(l(w,'entry',y),x);};}if(m){setTimeout=s(setTimeout,'setTimeout');setInterval=s(setInterval,'setInterval');l.setWrapper(q,'entry');}var t={guard:q,unguard:r};e.exports=t;},null);</p>
  
  <p>Then I tried to changed code from </p>
  
  <pre><code>  js.src = "http://connect.facebook.net/en_US/sdk.js";
  </code></pre>
  
  <p>to </p>
  
  <pre><code> js.src = "http://connect.facebook.net/de_DE/sdk.js#xfbml=1&amp;version=v2.1";
  </code></pre>
  
  <p>or   </p>
  
  <pre><code> js.src = "http://connect.facebook.net/de_DE/sdk.js#xfbml=1&amp;version=v2.0";
  </code></pre>
  
  <p>which brings additional warnings</p>
  
  <p>Invalid App Id: Must be a number or numeric string representing the application id.</p>
  
  <p>FB.init has already been called - this could indicate a problem</p>
  
  <p>and same previous error:</p>
  
  <p>Uncaught Error: invalid version specified at sdk.js:96</p>
  
  <p>What is wrong with this code and how to just simply initialize or log in to facebook. Please let me know.  </p>