Ver Mensaje Individual
  #5 (permalink)  
Antiguo 08/02/2008, 10:16
sqa212
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 10 meses
Puntos: 0
Re: Detectar si se está conectado a internet

Pense que debia funcionar

y creo que funciona

<html>
<head>
<script language="javascript">
var imgsrc = 'http://www.google.es/intl/en_com/images/logo_plain.png';
var img = new Image();

img.onerror = function () {
alert("No hay conexion a internet.");
}
img.onload = function () {
alert("Hay conexion a internet.");
}

img.src = imgsrc;

</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
<img src="http://www.google.es/intl/en_com/images/logo_plain.png" onerror="this.onerror=null;this.src='imagencd.jpg' ;">
</body>
</html>