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 --><divid="flash-content"><objectclassid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"width="200"height="200"id="SoundSpectrum2"align="middle"><paramname="movie"value="SoundSpectrum2.swf" /><paramname="quality"value="high" />
            ...

And then the JavaScript:

functionreloadFlash() {
   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"