Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/11/2011, 15:44
Urdaris_Nox
 
Fecha de Ingreso: mayo-2008
Mensajes: 103
Antigüedad: 16 años
Puntos: 14
Respuesta: Agregar Librerías de Javascript dinámicamente

Cita:
Iniciado por ryugen Ver Mensaje
yo suelo usar esta función, que permite agregar una funcion cuando se cargue correctamente
Código Javascript:
Ver original
  1. function loadScript(url, callback) {
  2.     var script = document.createElement("script")
  3.     script.type = "text/javascript";
  4.     if (script.readyState) { //IE
  5.         script.onreadystatechange = function () {
  6.             if (script.readyState == "loaded" || script.readyState == "complete") {
  7.                 script.onreadystatechange = null;
  8.                 callback();
  9.             }
  10.         };
  11.     } else { //Others
  12.         script.onload = function () {
  13.             callback();
  14.         };
  15.     }
  16.     script.src = url;
  17.     document.getElementsByTagName("head")[0].appendChild(script);
  18. }

¿Pero esa función solventa el problema de librerias cargadas repetidamente?
No veo en el código que me dices control de las librerias ya cargadas.