I have a problem with facebook apps. I have two diffrent apps w开发者_开发知识库ith two appIds. I`d like to have them both on one page. If I use the iframe it is no problem. If I use the following , hmm. I dont know how to get 2 appIds in one page. By the way, does anybody know, how to deactivate the comment function in the like-button?
window.fbAsyncInit = function() {FB.init({
appId : 'APP_ID_1',
status : false, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : false, //enables OAuth 2.0
});
FB.Event.subscribe('edge.create', function(targetUrl) {
_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]);
});
FB.Event.subscribe('edge.remove', function(targetUrl) { _gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]); }); };
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/de_DE/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
<?php //like button ?>
<fb:like layout="button_count" font="arial" href="http://www.example.com/eeee"></fb:like>
For security reasons, an APP ID must be linked to a single domain. Please see the "Site URL" field on your App Settings (https://developers.facebook.com/apps). You will not be able to authenticate (or perform call which require authentication, dialogs, etc.) from two different APP IDs on the same URL. You might be able to combine both APPs code on a single one. Why do you need two different APP IDs?
If you detail the functionality you want to achieve I might be able to suggest you an alternative solution.
Many thanks
Daniel Torvisco - Developer Support Engineer at Facebook
Why not use iframes
, just add the contents you want in two different iframe sections (use JS to control both of them). There're going to be a few problems with layouting the screen, but I'm sure your designers can work with it. Regarding that thing someone told about security, that's bullshit. You can define as many Apps as you want, and within each App you have as many domains as you want. For testing in different domains, just configure your /etc/hosts
file with the same domains you defined in the App (on Windows I known that there's a hosts
file, don't know where it is though). If you want to use some specific FB API calls, then you can find a few problems and it can be really trick to workaround those OAuth necessities for authentication and authorization, but for just the buttons you asked, it should be pretty easy to implement.
Hope it helps. Best,
精彩评论