How can you expand the FB.login () popup in the max browser window?

Basically, here is my js code.

<script> window.fbAsyncInit = function() { FB.init({ appId: '<?php echo $appId; ?>', cookie: true, xfbml: true, oauth: true, channelUrl: '//www.domain.com/channel.html' }); FB.Event.subscribe('auth.login', function(response) { window.location.reload(); }); FB.Event.subscribe('auth.logout', function(response) { window.location.reload(); }); }; (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); }()); function login() { FB.login( function(resp) { //not important atm} }, {scope: 'email, user_location, user_website'} ); } </script> 

The button is used to call the login () function

The code is working fine. It is paired with PHP sdk and I can authenticate just fine. The problem is pop-ups. When the browser window is maximized (this is consistent between IE and FF on three different computers. Add-ons are disabled), pop-ups are displayed in the center vertically, but in the absolute right of the screen horizontally. When the window is not maximized, it is centered in order. The fb-root sabot right after the body tag and everything I tried did not fix it. The previous user stated that they fixed this problem by overriding window.open () and editing the left attribute, however, in fact, they never developed how to do this. Since sdk is extracted from FB, modding is not entirely possible. Also, I would prefer this code to work.

Also, this js code used on a blank page on the test server presented the same error. I think this is most likely a problem with the SDK code, but I'm not sure. Any ideas on how to make this work, hack or not, are appreciated. I am working on it forever!

EDIT: Almost forgot. When I use the xfbml login button, the popup is ok.

+4
source share

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


All Articles