Refresh window after facebook as

I created an application on the company page to add additional tabs / pages with “similar gates” so that the user does not like our page before moving forward. Similar gates sit in the place of, say, “index.php”, if the user likes that our page “index2.php” is included, they DO NOT like that “index1.php” is included instead. All this works correctly.

My problem is that I would like to enable the "like" button on the "index1.php" page (if we don't like them). I have included a button that allows the user to please us, but you need to update it after clicking on this button so that the user can be rated again with similar shutters and redirected accordingly.

The code below allows the user to love, but does not redirect as I would like. I look at the examples on the fb developers page, but I'm new to fb app dev and can't understand my error. Any help would be appreciated, hope this is enough information, but answer if you need more. Thanks for any help you can provide.

<div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); FB.Event.subscribe('edge.create', function() { top.window.location = 'http://www.facebook.com/pages/TAG_Communications/122751567742494?sk=app_243094502403141'; } ); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-like" data-href="http://www.facebook.com/pages/TAG_Communications/122751567742494" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div> 
+4
source share
1 answer

Wow, I'm trying to do the same and was looking for it at the same time that you posted this question! Not much on this.

I came across a http://www.techjam.gr/2011/web-design/execute-javascript-facebook-button-clicked/ , which explains what to do in order to launch the script callback after the button is pressed very clearly . I see that you are already doing this for the most part, but there may be several parts that you have explained that you left or did not indicate.

I also ran into a lot of problems trying to redirect parent frames, as it causes a javascript access security error for cross-domain. Not sure if this is part of your problem. For my own case, I plan on simply redirecting my iframe page from something like no-fan.php to fan.php on click - I don't need to overestimate whether they are a fan or not with my fangate code if they clicked a similar button.

Hope this helps you.

UPDATE:

Got a job using the links above! Here's what I did (code below): Be sure to use the regular FB.init code. Add a script callback with a redirect code above the button. Add the xfbml version of the similar button. What is it!

Note that I actually used top.window.location and in any case sent it to my fangate evaluation code. The reason is that if you just redirect the frame, it leaves the rest of the page as it is, and it still has a facebook button, similar to the button next to the header. Updating the entire page gets everything you need and avoids confusion.

code:

  <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script> FB.init({ appId :'your id here', status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true, // parse XFBML channelUrl : 'full path to file', // channel.html file oauth : true // enable OAuth 2.0 }); </script> <script> FB.Event.subscribe('edge.create', function(href, widget) { top.window.location = 'your tab url'; }); </script> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-like"><fb:like href="your page you want to like" send="false" layout="button_count" width="200" show_faces="false"></fb:like></div> 
+8
source

All Articles