IE에서 자바스크립트를 이용하여 플래시 오브젝트를 클립보드로 복사할 때, object 객체를 선택, 복사하면 FlashVars 속성이 누락되어 복사되는 문제가 있습니다. 그러나 embed 객체를 복사하면 그런 문제가 없습니다.
그러므로 아래 코드와 같이 object 객체의 altHtml 속성을 이용하여 embed 객체를 동적으로 생성, 이 embed 객체를 복사하도록 하면 됩니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // Gets Flash object. var obj = document.getElementById("flashObjectID"); var alt = obj.altHtml; // embed tag // Creates a temporary embed object in the "tempLayer" layer. var temp = document.getElementById("tempLayer"); temp.innerHTML = alt; // Selects and copies the temporary embed object to the clipboard. var range = document.body.createTextRange(); range.moveToElementText(temp); range.select(); range.execCommand('copy'); range.moveToPoint(0,0); range.select(); range = null; // Removes the temporary embed object. temp.innerHTML = ""; |
IE에서 object 태그를 사용하지 않고 직접 embed 태그만 사용하는 경우나, 파이어폭스 등 비IE 브라우저에서는, 이럴 필요가 없이, 바로 embed 객체를 선택하여 복사해주면 되죠.
Tags: Flash, FlashVars, JavaScript



나이수 -_-)b