Reputation: 417
I was wondering wether it is possible to redirect someone to a different tab url after using a publish to wall popup dialog.
Current publish to wall script.
<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>
The redirect must be taken place inside the iframe..so after someone had publish the post to his/her wall people get redicted to a thankyou page.
Upvotes: 1
Views: 441
Reputation: 907
Something like this?
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.');
}
});
Upvotes: 2