简体   繁体   中英

Facebook request dialog box not showing up on IE

In my facebook application i am using the facebook javascript sdk(code provided by facebook) to display dialog box(iframe) for sending app request to user friends. The iframe is working properly in firefox and chrome but not working in ie. Here's the code used

FB.getLoginStatus(function(response) {
                if (response.status === 'connected')
                {   var accessToken = response.authResponse.accessToken;
                    FB.ui({method: 'apprequests',
                            message: 'Checking App Request',
                            to: '<?php $i=0; foreach($friends as $id){if($i==50) break; echo($id.","); $i++;}?>',
                            title: 'Request',
                            display: 'iframe',
                            access_token: accessToken
                            }, requestCallback);
                }
                });

That's a bug that is handled by people by setting display to popup value for IE. Gist with example :

// Detect browser and set the compatible Dialog display type
div = document.createElement('div');
div.innerHTML = '<!--[if IE]><i></i><![endif]-->';
ie = div.getElementsByTagName('i').length === 1;
if (ie) {
  display = 'popup';
} else {
  display = 'iframe';
}

// Make the call
FB.ui({
  method: "apprequests",
  message: message,
  display: display,
  to: facebook_friend_id
}, function(response) {
  facebook_request_id = response.request_ids[0];
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM