I am trying to get Zero Clipboard and jQuery UI Dialog to play well together, and that turned out to be pretty complicated.
Zero Clipboard allows you to copy to the clipboard from Javascript by placing a transparent Flash movie above the button so that the user clicks on Flash when he tries to click the button. This works well and cross-browser, as you can see on the demo page .
However, trying to use this in the jQuery UI dialog box, something seems to be wrong.
Firstly, I found that the flash element must be placed inside the dialog element, otherwise Chrome and IE refuse to respond to click events. This means that I cannot use the glue convenience method, but this is normal.
However, now for some reason IE will not accept the setText method in the Flash element.
An example of what I did is here . My code starts around line 300, and the most relevant lines are:
$("#showme").dialog({autoOpen: false, width: 550, height: 200}); $("#showme").bind("dialogopen", function() { if($("#clipflash").length == 0) { var btn = $("#d_clip_button"); $("<div id='clipflash' style='position:absolute; background: #f00; z-index: 9999' />") .css(btn.position()) .width(btn.width()) .height(btn.height()) .html(clip.getHTML(btn.width(), btn.height())) .appendTo("#showme"); } });
I painted the div red to make it easier to identify and set its z-index to 9999 to be safe. Then I set the position and size for the "button" cover and add HTML for the Flash element using clip.getHTML() .
I have been working on this for several hours, so any help would be greatly appreciated.
Almost forgot: my problem is that IE7 says that โObject does not support this property or methodโ inside the Zero Clipboard code.
UPDATE
Powtac's comment indicates what looks really promising:
I forgot my own golden rule: In order for the external external interface of Flash to work in IE 7, you need to type EMBED / OBJECT HTML into a DIV element AFTER adding it to the DOM. Stupid IE.
However, switching the .html(clip.getHTML(btn.width(), btn.height())) lines .html(clip.getHTML(btn.width(), btn.height())) and .appendTo("#showme") did not help. Even making setTimeout to add flash HTML later did not help. I feel like I'm really close though ...