gpt4 book ai didi

javascript - FB.Event.subscribe 在 fb :like post wall dialogue closes 之后响应

转载 作者:行者123 更新时间:2023-11-28 09:32:15 25 4
gpt4 key购买 nike

我有这个 fb:like 按钮...



当喜欢按钮被喜欢时,我正在重定向/响应。使用 FB.Event.subscribe...

FB.init();
jQuery(document).ready(function() {
FB.Event.subscribe("edge.create", function(href) {
var data = { action: "virallocker", myID: "'.$my_id.'"};
jQuery.post("viral-lock.class.php", data, function(response) {
if (virallocker_use) location.reload();
});
});
});

看看当您点击“点赞按钮”时会发生什么情况 - 会出现帖子墙对话框...

/image/QVJSm.jpg

现在我遇到的问题是 location.reload();在 JavaScript 中,在“发布到墙”对话框完成或关闭之前触发。

location.reload(); 在单击 Like 按钮时运行。

我的问题是,有人可以帮我调整脚本,以便在关闭或发布“发布到墙”对话框后运行响应,而不是单击“赞”按钮。

通过“赞”按钮查看我的问题... http://goo.gl/9efLZ


也发布在这里www.javascriptquestions.com

最佳答案

当您点击“赞”时,Facebook 不会再让您自动提交到留言墙。用户必须自己写一些东西并发布。我所做的是让用户等待 15 秒,同时在点击“喜欢”后,他们有足够的时间发表评论和指向他们的墙的链接。

所以代替 location.reload();放置 StartTheCounter();这应该可以解决问题。

// Start The counter
// At what number shall the countdown counter start?
CounterStart = 15;

// This function CustomAction() can be modified to do
// whatever you want done every second.

function CustomAction() {
document.getElementById('counter').innerHTML = 'You\'ll be automatically redirected </br> within ' + CounterStart + ' seconds.';
} // end of function CustomAction()

// end of JavaScript customization


function Decrement() {
CounterStart--;
CustomAction();
if(CounterStart <= 0) {

//alert('Timer reached 0');
window.location.href = "http://www.domain.com/new-location.php";

}
else { setTimeout('Decrement()',1000); }
}

function StartTheCounter() {
setTimeout('Decrement()',1000);
}

关于javascript - FB.Event.subscribe 在 fb :like post wall dialogue closes 之后响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13604861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com