Facebook hack - fb:prompt-permission onclick
As many of you know I work in i2we inc. and we create Facebook applications. Facebook has its own tags called FBML and own JavaScript library FBJS (all you JS-code is transferred into it, so there are some restrictions). There are also "extended permissions" - user can allow application to perform this or that action (change status, send emails and sms). User can be prompted for permission with <fb:prompt-permission> FBML tag, its required parameter is - perms, which has "extended permission" name in it, for example, "email" or "sms". It also may have optional "next_fbjs" parameter - FBJS function to run after user grants the extended permission. This prompt dialogue is called with <fb:prompt-permission> tag, text inside the tag becomes the link, when you click on it, dialog-box with 2 buttons: "Approve" and "Cancel" pops up.
We had a task to consider user completed the action even if he clicked Cancel on this dialog box, but we can't handle this situation as with next_fbjs. We decided to make an AJAX request when user clicks on dialog link, but this FBML tag doesn't have onclick. The solving was next - to put inside fb:prompt-permission <div> tag, and add to div-у onclick with the JavaScript function we need.
Here is the test example: