gpt4 book ai didi

javascript - 从 iframe 发布到墙上后重定向

转载 作者:行者123 更新时间:2023-11-30 18:34:19 25 4
gpt4 key购买 nike

我想知道在使用发布到墙弹出对话框后是否可以将某人重定向到不同的标签 url。

当前发布到墙上脚本。

<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: APPID,
status: true,
cookie: true,
xfbml: true}); };
(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>

<script>
function publish_to_wall(){
FB.ui({
method: 'stream.publish',
display: 'iframe',
name: ('some text ') + (document.getElementById('myText').value) +(' some text'),
caption: 'some caption',
link: 'some url',
picture:'some image url'
});
}
</script>

重定向必须发生在 iframe 内..所以在有人将帖子发布到他/她的墙上后,人们会被重定向到感谢页面。

最佳答案

是这样的吗?

feedData = {};
feedData.method = 'feed';
feedData.name = "title";
feedData.link = "url";
feedData.picture = "url to picture";

FB.ui(feedData,function(feedResponse) {
if (response && response.post_id) {
alert('Post was published.');
//do redirect
window.location = "url to thank you page"
} else {
alert('Post was not published.');
}

});

关于javascript - 从 iframe 发布到墙上后重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8730485/

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