Facebook asks 2.0, how do I change the Accept button URL to be a non-Facebook URL?

My app is outside the facebook canvas. The facebook 2.0 request dialog only redirects to the canvas URL for example. apps.ibibo.com/YOURAPP . How can I make it open my own URL? This is possible in the old FBML form with fb:request-form and setting req-url .

Are there 2.0 requests limited only to facebook internal urls? My requirement is to send requests for the game, but my game is outside of facebook. that is, when you click "ACCEPT", the URL should be

" http://www.mydomain.com/mygame ", not

" http://apps.facebook.com/mygame ".

enter image description here

These methods don't seem to meet my requirements: http://developers.facebook.com/docs/reference/dialogs/requests/ (only canvas URL redirection)

I thought of one workaround like this: The user clicks “ACCEPT” and comes to the canvas URL, and from the canvas URL I redirect it to my URL outside of facebook. But I'm not sure if this is consistent with facebook policy? (mentioned here in paragraph 4 of the first paragraph: http://developers.facebook.com/blog/ )

+6
source share
2 answers

Unfortunately, the accept button will now always bring you to the application page, as you can see, and now there is no way for it to go elsewhere. You will have to redirect them from the canvas sheet. However, I don’t see that this is contrary to Facebook’s policy, but since Facebook requests can initially be sent from outside of Facebook using the iframe plugin. If you want to have access to the external URL of the accept button, I would post the feature request to Facebook.

+2
source

A jquery script is required to override the default function in facebook. However, this only works when a person goes to "http://apps.facebook.com/mygame" and clicks "add application".

It’s easier to just have a welcome page, users click “PLAY” and open a new window on your page.

More details: http://developers.facebook.com/blog/post/525/ - good luck code!

Put <button id="fb-auth">Login</button> somewhere on the mygame page and add this javascript code:

 function updateButton(response) { //Log.info('Updating Button', response); var button = document.getElementById('fb-auth'); if (response.status === 'connected') { //button.innerHTML = 'Logout'; button.onclick = function() { FB.logout(function(response) { //Log.info('FB.logout callback', response); }); }; } else { //button.innerHTML = 'Login'; button.onclick = function() { FB.login(function(response) { //Log.info('FB.login callback', response); if (response.status === 'connected') { //Log.info('User is logged in'); window.open("http://xxxxxxxxxxxxxxxx/some.html"); } else { //Log.info('User is logged out'); } }); }; } }; // run it once with the current status and also whenever the status changes FB.getLoginStatus(updateButton); FB.Event.subscribe('auth.statusChange', updateButton); 
+5
source

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


All Articles