Skip to content Skip to sidebar Skip to footer

Reload Embedded Swf In Html Page In IE

I have a swf file embedded in a html page. I want to reload the swf file without refreshing the page. There is a same problem asked here: reload/ reset embedded swf on click And I

Solution 1:

If your .swf is embedded with <object>, use data property:

document.getElementById('flash_99674493').data += '';

For ones embedded with <embed> use src:

document.getElementById('flash_99674493').src += '';

Adding the empty string to data or src causes their reload.

In IE we have to replace the object with the same one:

var o = document.getElementById('flash_99674493');
var n = o.cloneNode(!0);
o.parentNode.insertBefore(n, o);
o.parentNode.removeChild(o);

Solution 2:

Have you tried using regular JavaScript using a wrapper? I did a test with this working on old browser such as IE 9.

<!-- wrapper around your flash object -->
<div id="flash-content">
        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="200" height="200" id="SoundSpectrum2" align="middle">
            <param name="movie" value="SoundSpectrum2.swf" />
            <param name="quality" value="high" />
            ...

And then the JavaScript:

function reloadFlash() {
   var content = document.getElementById('flash-content');
   var currentArray = [];

   while (content.firstChild) {
      currentArray.push(content.firstChild.cloneNode(true));
      content.removeChild(content.firstChild);
   }

   currentArray.forEach(function(item) {
      content.appendChild(item)
   });
}

Post a Comment for "Reload Embedded Swf In Html Page In IE"