2013-10-01 1 views
2

광 고찰에 대한 설명이 작성되면 작은 알림 기능을 만들려고합니다. 그것은 데스크톱 버전에서 완벽하게 작동하지만 모바일 버전에서는 FB.Event.subscribe이 실행되지 않습니다. fbAsyncInit 및 FB.init 모두가 올바르게 해고되고facebook FB.Eventscribe가 모바일 버전에서 실행되지 않습니다.

<script> 

     window.fbAsyncInit = function() { 

     // init the FB JS SDK 
     FB.init({ 
      appId  : 'XXXX' 
      channelUrl : 'http://www.xxx.dk/channel.php', 
      status  : true, 
      xfbml  : true 
     }); 


     FB.Event.subscribe('comment.create', 
      function (response) { 
       $.ajax({ 
        url: 'http://www.xxx.dk/notify.php', 
        type: 'POST', 
        data: { aid: {$viewad.aid} }, 
        success: function(data) { }, 
        error: function(data) { } 
       }); 
      }); 
     }; 

     (function() { 
     var e = document.createElement('script'); e.async = true; 
     e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
     document.getElementById('fb-root').appendChild(e); 
     }()); 
</script> 

:

는이 코드를! 내가 경고에 넣어 경우 ("해고") 나는 그 경고를 얻을 것이다,하지만 FB.Event.subscribe 내부

channel.php이 포함 :

<?php 
$cache_expire = 60*60*24*365; 
header("Pragma: public"); 
header("Cache-Control: max-age=".$cache_expire); 
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$cache_expire) . ' GMT'); 
?> 
<script src="//connect.facebook.net/en_US/all.js"></script> 
+0

해고되지 않은 특정 ** comment.create ** 이벤트를 확인할 수 있습니다. ** edge.create **가 정상적으로 작동합니다. –

+0

그리고 댓글 상자의 모바일 버전 일뿐입니다. ** mobile = "false"** 설정은 문제를 해결하지만 좋지 않습니다. –

+0

가능한 [facebok comment.create 모바일 - ios Safari 및 Android 브라우저에서 실행 안 함] (http://stackoverflow.com/questions/17844268/facebok-comment-create-not-firing-on-mobile-ios-safari) - and - android-browser) – Guy

답변

관련 문제