The Facebook permission popup is blocked even when a custom event is triggered. What for?

Here is the page: http://textbookcentral.com.au/26/university-of-new-south-wales/buy/69897/acct1501/?query=

When "Tell others, I buy a tutorial on my facebook wall." the checkbox is selected, and you click "Request this tutorial", regardless of whether the form input is valid or not, it will try to make a wall post on your facebook wall by opening the login dialog box or the permission dialog as necessary.

However, the dialog does not appear if your browser has blocked pop-ups. I tested this in Safari and Firefox.

javascript only starts when you click the "Request this tutorial" button, but the pop-ups are still blocked, why?

(View the source, scroll down, and you will see the following corresponding code.)

<a href="#" class="submit button" onclick="make_facebook_request_post()">Request this textbook</a></p> </div> </form> </div> <script type="text/javascript"> function make_facebook_request_post() { if ($('#id_facebook').is(':checked')) { facebook.do_post(function(success) {}, 'I am using http://textbookcentral.com.au to buy a textbook for ACCT1501.', 'publish_stream') } } </script> 

The facebook.do_post function will call FB.api calls. See http://textbookcentral.com.au/site_media/static/central/js/facebook.js

+6
source share
1 answer

Yup, they indicate this in their documentation.

http://developers.facebook.com/docs/reference/javascript/FB.login/

Calling FB.login causes the JS SDK to try to open a popup window. Thus, this method should be called only after the user clicks the event, otherwise the pop-up window will be blocked by most browsers.

+5
source

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


All Articles