[IE7] Problème avec les animations Flash

Dernière mise à jour le 21 septembre 2009 à 17:10 par irongege
Publié par warlix


Voici une astuce qui vous aidera si dans Internet Explorer 7, une animation flash est remplacée par un cadre gris sur lequel il faut cliquer pour lancer l'animation.
Il suffit d'utiliser un simple script.


Créez un fichier .js (JavaScript), et copiez-collez ce code :
/*
  activateActiveX
  ---------------
  Purpose: Dynamically replace any elements that will be affected by the new security feature in IE6/IE7 that requires a user to click certain types of elements to activate them before use.
  Usage: Include this file at the end of your html document using the following...
  <script language="JScript" type="text/jscript" src="activateActiveX.js"></script>

  Since this script is in response to a software patent lawsuit, I feel it necessary to state the following...

  License:
  activateActiveX is Copyright (C) 2006 Jason Baker (therippa AT gmail.com). It is available as open source code from: http://therippa.blogspot.com

  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details http://www.gnu.org/licenses/gpl.html*/

//Determine browser, we only need this for Internet Explorer
if (navigator.appName == "Microsoft Internet Explorer") {

//Array of elements to be replaced
var arrElements = new Array(3);
arrElements[0] = "object";
arrElements[1] = "embed";
arrElements[2] = "applet";


//Loop over element types
for (n = 0; n < arrElements.length; n++) {

  //set object for brevity
  replaceObj = document.getElementsByTagName(arrElements[n]);

  //loop over element objects returned
  for (i = 0; i < replaceObj.length; i++ ) {

  //set parent object for brevity
  parentObj = replaceObj[i].parentNode;

  //grab the html inside of the element before removing it from the DOM
  newHTML = parentObj.innerHTML;

  //remove element from the DOM
  parentObj.removeChild(replaceObj[i]);

  //stick the element right back in, but as a new object
  parentObj.innerHTML = newHTML;

  }
}
}



Puis placez un lien vers votre fichier avant la balise de fermeture </body> des pages qui posent problème :

<script language="JScript" type="text/jscript" src="activateActiveX.js"></script>
</body>
</html>



On enregistre, et hop, la magie opère, plus besoin de devoir cliquer pour lancer l'animation.
Meilleures réponses pour « Problème avec les animations Flash » dans :
[Navigateurs] Désactiver le son dans les animations Flash VoirCouper le son des animations Flash Cette astuce fonctionne pour tous les navigateurs installés sur l'ordinateur (puisqu'il s'agit d'un petit programme indépendant à installer). Si vous ne voulez plus vous faire surprendre par le son automatique...
[Powerpoint] Mettre une animation Flash dans une présentation VoirVoici une petite vidéo qui va tout vous expliquer: http://sebsauvage.net/temp/wink/flash_in_powerpoint.html
Afficher les images et les animations Flash dans le navigateur VoirQuand vous allez sur un site internet, vous n'avez plus d'images affichées ; elles sont remplacées par un petit rectangle avec un carré rouge ou un triangle bleu (par exemple). 1 - Vérifier d'abord les paramètres de votre navigateur : Pour...