Ver Mensaje Individual
  #6 (permalink)  
Antiguo 06/10/2012, 22:55
Avatar de NSD
NSD
Colaborador
 
Fecha de Ingreso: mayo-2012
Ubicación: Somewhere
Mensajes: 1.332
Antigüedad: 12 años
Puntos: 320
Respuesta: 132 segundos en verificar si urls existen y cargar la pagina, es normal?

Cita:
no entendí lo de hacer el script en jquery y que cargue manualmente el contenido. oO
jojo me hisiste pensar con eso hasta recien, te lo agradesco, tendrias que hacer algo asi:

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="es" xml:lang="es">
  3.     <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.     <Script Type="text/javascript" Src="JQuery.js" > </Script>
  6.     <script type="text/javascript">
  7.     function verifica(){
  8.         $('img').each(function(){  
  9.             Archivo=$(this);
  10.             $.ajax({
  11.                 type: "GET",
  12.                 url: Archivo.attr('src'),
  13.                 async:false,
  14.                 error: function(objeto, quepaso, otroobj) { Archivo.fadeOut('fast'); }
  15.             });
  16.         });
  17.     }
  18.     </script>
  19.     <title>Documento sin título</title>
  20.     </head>
  21.     <body>
  22.         <img src="http://1.bp.blogspot.com/_tW-DAweEXA8/SwrcmMtEoNI/AAAAAAAAAzs/EqyWKFhu3Dk/s1600/imagenes-para-hi5-14.jpg" />
  23.         <img src="http://2.bp.blogspot.com/_EZ16vWYvHHg/TVBYGsQdaYI/AAAAAAAAW_o/3LpEjv07e2Q/s1600/www.BancodeImagenesGratuitas.com%2B-%2BImagenes%2Bde%2BAmor%2B-%2B14%2Bde%2BFebrero%2B-15.jpg" />
  24.         <img src="http://www.noando.com/noexisto.png" />
  25.         <img src="http://www.noando.com/noexistotampoco.png" />
  26.         <button onclick="verifica();">verificar</button>
  27.     </body>
  28. </html>

1_perdon por las imagenes son las primeras que salieron en google

2_tendrias que llamar a la funcion cuando carga la pagina y en vez de recorrer las imagenes recorrer todos los elementos que hagan falta.

notaras que las imagenes que no existen desaparaecen, eso es lo que importa, y en esta funcion puedes basar tu sistema de validacion jquery del lado del cliente que no recarga tu servidor ni tarda demaciado
__________________
Maratón de desafíos PHP Junio - Agosto 2015 en FDW | Reglamento - Desafios