Ver Mensaje Individual
  #7 (permalink)  
Antiguo 28/01/2013, 14:21
Avatar de jonni09lo
jonni09lo
Colaborador
 
Fecha de Ingreso: septiembre-2011
Ubicación: Estigia
Mensajes: 1.471
Antigüedad: 12 años, 8 meses
Puntos: 397
Respuesta: Re: Detectar el cierre de la ventana actual

Cita:
Iniciado por art_rockerd Ver Mensaje
Hola amigo, quise intentar esto en una pagina pero no pasa nada, alomejor lo estoy haciendo mal, te escribo mi código, lo que quiero en realidad es que cuando cierre el navegador JS envie hacia una pagina de PHP que destruye la sesion y redirige al Index... Gracias!

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Untitled Document</title>
  5.  
  6. <script type="text/javascript" language="javascript">
  7. function cierraNav(){
  8.     alert ("Ud esta abandonando este sitio, su sesion se finalizara");
  9.     }
  10. </head>
  11.  
  12. <body onunload="cierraNav()">
  13. </body>
  14. </html>
Hola no revivas mensajes que son muy viejos en cuanto a tu problema puedes probar esto

Código Javascript:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6.  
  7. <script type="text/javascript">
  8.     window.onunload = window.onbeforeunload = function(){
  9.         return "Ud esta abandonando este sitio, su sesion se finalizara";
  10.     };
  11. </script>
  12. </head>
  13.  
  14. <body>
  15.    
  16. </body>
  17. </html>

Un Saludo
__________________
Haz preguntas inteligentes-Como ser Hacker
No hacer preguntas por mensaje privado. No sólo no es inteligente sino que es egoísta.