PDA

View Full Version : IFrame with designmode on, embedded swf not auto-playing in IE8



python1234
17 Feb 2011, 02:03 AM
Hello,

Do you guys know any workaround or have any solution for my problem:
I'm trying to embed a swf object into an IFrame element which has the designMode turned on. I successfully did that in Firefox, Safari, Opera, Chrome, but for IE8 and IE7 the swf is not autoplaying. To play it I have to double-click it and then if editing the IFrame the swf stops playing when losing focus. My code looks as follows:



<html>
<head>

<script type="text/javascript">

function populateIframe() {
var ifrm = document.getElementById('myIframe');
ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
ifrm.document.open();

ifrm.document.write('sdasdasdasd <object classid=\"clsid27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"40\" height=\"40\"><param name=\"movie\" value=\"flash_heart01.swf\" /><param name=\"play\" value=\"true\" /><param name=\"loop\" value=\"true\" /><param name=\"flashvars\" value=\"playerMode=embedded\" /></object> asdasdasd');

ifrm.document.close();
ifrm.document.designMode = 'On';

}
</script>
</head>
<body onload="populateIframe();" width="1000px" height="700px">
<iframe id="myIframe" width="1000" height="700"></iframe>
</body>
</html>

You can try it with any swf. My swf is a simple flash with 3 frames in the main scene, nothing special. You can try that code with any swf in IE8 and shall see my problem. Please notice that current code(which I displayed above) doest work at all with FF, Opera, or others since it only targets the IE browser and its problem just to show the issue.

Please advise or help

Thanks