페이스북 공유하기 소스 분석좀 부탁드려요.

· 11년 전 · 819
<html>
<head>
</head>
<body>
<script>(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/ko_KR/all.js#xfbml=1&appId=354047521446386";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId      : '354047521446386', // 앱 ID
status     : true,          // 로그인 상태를 확인
cookie     : true,          // 쿠키허용
xfbml      : true           // parse XFBML
});

FB.Event.subscribe('auth.login', function(response) {
document.location.reload();
});

};
</script>

<button class="share-btn">test</button>

<script>
document.querySelector('body').onclick = function(){

var params = {};
params['message'] = 'message';
params['name'] = 'name';
params['description'] = 'description';
params['link'] = 'http://description.co.kr';
params['caption'] = 'caption';
  
FB.api('/me/feed', 'post', params, function(response) {
  if (!response || response.error) {
    alert('Error occured');
  } else {
    alert('Published to stream - you might want to delete it now!');
  }
});


};
</script>
</body>

</html>

 

이렇게 실행하면 Error occured

이렇게 에러를 뿌려버립니다.

 

잘되는 소스코드가 있긴하나..

별 문제 없어보이는데 왜 안될까 싶네요..

 

만들어보신분 답변 부탁드립니다.

감사합니다.

|
댓글을 작성하시려면 로그인이 필요합니다.

토크

개발과 관련된 어떤 얘기도 괜찮습니다.

+
제목 글쓴이 날짜 조회
11년 전 조회 1,451
11년 전 조회 872
11년 전 조회 1,637
11년 전 조회 2,476
11년 전 조회 1,130
11년 전 조회 1,422
11년 전 조회 932
11년 전 조회 906
11년 전 조회 1,704
11년 전 조회 2,066
11년 전 조회 1,233
11년 전 조회 860
11년 전 조회 761
11년 전 조회 1,047
11년 전 조회 820
11년 전 조회 874
11년 전 조회 1,166
11년 전 조회 1,365
11년 전 조회 1,250
11년 전 조회 934
11년 전 조회 1,242
11년 전 조회 984
11년 전 조회 1,214
11년 전 조회 1,573
11년 전 조회 930
11년 전 조회 1,564
11년 전 조회 1,159
11년 전 조회 1,059
11년 전 조회 792
11년 전 조회 1,058