2015-01-22 4 views
0

트리거 공유 버튼

<!DOCTYPE html> 
 
<html> 
 
<head> 
 
<meta charset="UTF-8"> 
 
<title>My Feed Dialog Page</title> 
 
</head> 
 
<body> 
 

 
    //I can trigger the FB.ui with this image here but thatś not what I want. I want to trigger the FB.ui with the test function with the native facebook-share button with the class fb-share-button below. 
 

 
<img id="share_button" onclick="test();" src=""> 
 
<script> 
 
    window.fbAsyncInit = function() { 
 
    FB.init({ 
 
     appId  : '', 
 
     xfbml  : true, 
 
     version : 'v2.2' 
 
    }); 
 
    }; 
 

 
    (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 = "//connect.facebook.net/en_US/sdk.js"; 
 
    fjs.parentNode.insertBefore(js, fjs); 
 
    }(document, 'script', 'facebook-jssdk')); 
 
    
 

 
function test(){ 
 
    FB.ui({ 
 
    method: 'share_open_graph', 
 
    action_type: 'og.likes', 
 
    action_properties: JSON.stringify({ 
 
     object:'https://developers.facebook.com/docs/', 
 
    }) 
 
    }, function(response){}); 
 
} 
 
</script> 
 

 

 
<div class="fb-share-button" data-href="http://testgenerall.webhomeschool.de/test_fb_ui.html" data-redirect="http://testgenerall.webhomeschool.de/test_fb_ui.html" data-layout="button_count"></div> 
 
</body> 
 
</html>

답변

0

것은 이것이 가능하지, 당신은 단지 공유 버튼의 이미지를 사용할 수 있지만 공유를 사용 할수 없어를 버튼 플러그인을 사용하여 사용자 정의 기능을 트리거 할 수 있습니다.