Previously I wrote about embedding flash in a facebook dialog box. However the technique used doesn't work anymore - the fb:js-string tags aren't working reliably, and when they do their is some new "features" to the dialog box that is preventing my previous code from working in all browsers.
I've whipped up a new approach, and tested it in IE8, IE8 in Compatibility View, Chrome 6, and Firefox 3.6.6. This should work in other browsers as well, though its important to note that Facebook has announced that FBML is going away; at the end of this year no new FBML apps can be created.
This version starts with going back to the fb:dialog tag in FBML instead of using the FBJS new Dialog(). The most important part of using this is creating an id in the body of the dialog we can find via javascript once the dialog is open.
This is triggered by the typical clicktoshowdialog="mydialog" attribute on a link, however at the same time we also put a onclick event on the same link. This fires and we leverage javascript to find the placeholder in the dialog, create a swf object and inject it into the dialog, then back track and change the dialog title. Only one fb:dialog is used for however many dialogs you actually want.
Here's the code:
3 comments:
Thanks for the post -- this was a huge help to me just now.
Thanks for the code you've provided.
Just one problem I've noticed:
Even though the dialog is loaded (and one video is playing) we can still click on the link(s) and that will load/add the clicked video into the dialog box...thereby showing 2 videos in the dialog box....and this can be repeated an infinite number of times.
Is there a way to fix this problem?
Thanks again.
thank you - you are my hero.
Post a Comment