<body><div id="fb-root"></div>
<a href="#" onclick="FbRequest('This page is amazing, check it out!','4d5da07acbbb0');">Send Request</a>
<script type="text/javascript">
function FbRequest(message, data){
FB.ui({method:'apprequests',message:message,data:data,title:'Share this site with your friends'},
function(response){
// response.request_ids holds an array of user ids that received the request
}
);
}
// typical application initialization code for your site
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
window.fbAsyncInit = function() {
FB.init({
appId : '123',
session : {},
status : true,
cookie : true,
xfbml : true
});
};
</script>
</body>
<a href="#" onclick="FbRequest('This page is amazing, check it out!','4d5da07acbbb0');">Send Request</a>
<script type="text/javascript">
function FbRequest(message, data){
FB.ui({method:'apprequests',message:message,data:data,title:'Share this site with your friends'},
function(response){
// response.request_ids holds an array of user ids that received the request
}
);
}
// typical application initialization code for your site
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
window.fbAsyncInit = function() {
FB.init({
appId : '123',
session : {},
status : true,
cookie : true,
xfbml : true
});
};
</script>
</body>
摘自:http://af-design.com/blog/2011/02/17/using-facebook-requests-to-promote-a-website/