Automatically refresh timeline page when button is clicked on app?

Before the graph was published on the pages, when the user clicked a similar button on the page, the page was updated by itself.

Now that the timeline is on, if you are in the application and press the upper right button, the page does not refresh by itself, and the application does not recognize that the user "liked" the page.

Is there a way or event on how to refresh the page automatically when the user clicks a similar button?

Thanks.

+4
source share
4 answers

An error was registered in FB, check it and subscribe to https://developers.facebook.com/bugs/228778937218386

+4
source

You can periodically check if the user likes this page:

FB.api ( "/me/likes/[page id]", function( response ) { if ( response.data ) { if( response.data.name ) { alert( "We've got a fan!" ); } else { alert( "Not a fan!" ); } } else { alert( "Something went worng..." ); } } ); 

In addition, if you need to move the user to another tab / application, you will need to refresh the entire page to use:

 top.location.href = "[new url]"; 
0
source

I was able to make a workaround to determine if the page still doesn’t use the timeline by looking for the album with the cover art in the album list of that page. So you can show fangates on these pages.

Here is an example:

http://graph.facebook.com/-page_id-/albums?fields=name

You do not need a token if the page has not been published yet.

The problem with this approach is that some pages do not yet have a cover, but this is a minority.

0
source

Try the following:

 FB.Event.subscribe('edge.create',function(){ window.location = '/some/awesome/url'; }); 
-one
source

Source: https://habr.com/ru/post/1399109/


All Articles