반응형
리턴값 O
function fnFbLogin(){
FB.login(function(response){
if (response.status === 'connected') {
fnSendFacebook();
} else if (response.status === 'not_authorized') {
alert("권한을 허용해주세요");
} else {
}
}, {scope: 'public_profile'});
}
function fnShare(){
FB.getLoginStatus(function(statres) {
if (statres.status === 'connected') {
fnSendFacebook();
} else {
fnFbLogin();
}
});
}
function fnSendFacebook(){
if(UserAgent.match(/iPhone|iPod|iPad|iPad2/i) != null) {
alert("팝업차단이 설정되어있는경우 참여가 불가능합니다.\n아이폰 설정에 들어가 팝업차단을 해제해주세요.");
}
FB.getLoginStatus(function(statres) {
if (statres.status === 'connected') {
FB.api('/me?fields=id,name', function(response) {
var sFId = response.id;
var sFName = response.name;
//var sFPic = response.picture.data.url;
var f = document.form1;
var sGetMsg = f.USR_MSG.value;
var sGetCountry = f.SET_COUNTRY.value;
var sImgUrl = "url"+ sGetCountry +".png";
FB.ui({
method: 'feed',
name: "이름",
//caption: "캡션",
description: sGetMsg,
link:"링크",
picture:sImgUrl,
//message: 'Facebook Dialogs are easy!'
}, function(response){
if (response && !response.error_message) {
//alert("공유완료.");
}else{
//alert("공유실패");
}
});
});
} else {
fnFbLogin();
}
});
}
반응형
'프로그래밍 > JavaScipt' 카테고리의 다른 글
| javascript youtube script js (0) | 2016.08.11 |
|---|---|
| javascript 날짜비교/일수 차이 계산 (0) | 2016.07.25 |
| javascript 모바일 기종 체크 (0) | 2016.07.19 |
| javascript 카카오톡 api 메시지보내기 (0) | 2016.07.19 |
| javascript 카카오스토리 api 링크공유 (0) | 2016.07.19 |