Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to close (hide) an FBML-dialog using the new Facebook JavaScript SDK?
    primarykey
    data
    text
    <p>I've wasted four hours today and several hairs trying to solve this issue but failed.</p> <p>We use <code>facebook.connect</code> to authorize users on our site and perform various actions. One of these actions should trigger <code>fbml:dialog</code>, I decided to use new JavaScript SDK. Here's the function I use:</p> <pre><code>function popupModalWindow(cat) { var oldSize = FB.UIServer.Methods["fbml.dialog"].size; FB.UIServer.Methods["fbml.dialog"].size = {width: 402, height: 112}; //FB.UIServer.id = FB.UIServer._active[id]; var messages = { interesting: '&lt;p&gt;By submitting my entry, I confirm that I have obtained permission from the persons whose picture and/or voice appears in my entry for use and publication in this contest as outlined in the Official Rules [link]&lt;/p&gt;' }; // alert(messages[cat]); FB.ui( { method: 'fbml.dialog', //id: 'ololo', display: 'dialog', width: 402, height: 112, /**/ //Should work that way according to the API reference size : {width: 402, height: 112}, fbml: '&lt;link rel="stylesheet" href="http://rentatext.mygrate.biz/styles.css"/&gt;&lt;div class="modal-white" style="width: 402px;"&gt;'+ '&lt;h6&gt;User Agreement&lt;/h6&gt;'+ '&lt;fb:js-string var="oloe"&gt;document.getElementsByTagName("iframe")[0].id;&lt;/fb:js-string&gt;'+ '&lt;div class="inner"&gt;'+messages[cat]+' &lt;a class="fb-close" onclick="FB.UIServer._active[oloe].close()"&gt;i agree&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;' , }, function() { alert(1); } ); console.debug(FB.UIServer); } </code></pre> <p>Unfortunately, the designer made these modal windows with grey background and some users may not notice the default "close" button at the top right corner of dialog. What I need is to bind an event to some custom element that will close this dialog. I've tried different approaches but none of them worked.</p> <p>The latest one throws "a138033292903816_FB is not defined" when I click <code>a.fb-close</code> with the onclick event handler. Maybe I'm missing something, I googled a lot but with no luck.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload