2
我正在嘗試在爲廣告創建註釋時創建一個小通知器。它的桌面版本完美無瑕,但在移動版本上,FB.Event.subscribe
未被解僱。facebook FB.Event.subscribe未在手機版上觸發
我有這樣的代碼:
<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>
兩個fbAsyncInit和FB.init被正確解僱了!如果我把警報(「發射」),我會得到警報,但內部沒有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>
我可以看到它是特定的** comment.create **事件沒有被解僱。 ** edge.create **正常工作。 –
而且它只是評論框的移動版本。設置** mobile =「false」**可以解決問題,但這並不好。 –
[facebok comment.create可能在手機上不射擊 - ios Safari和android瀏覽器](http://stackoverflow.com/questions/17844268/facebok-comment-create-not-firing-on-mobile-ios-safari -and-Android的瀏覽器) – Guy