• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Open a window on close of main window

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
On close of the main window, I want to popup a small window. The main window can be closed by the cross button on the right most side of the browser or by javascript window.close() or by ALT F4 key of the key board. How to catch this close event and pop up a new window.
Regards
Pashi.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use
window.document.onunload=new window("","","");
write this in the head section, just before body..
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


use
window.document.onunload=new window("","","");
write this in the head section, just before body..


...and loose visitor by visitor for ever
 
Pashi Soni
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I tried the code, but instead of poping a new window on unload, it is loading on load. So it is not working properly. Please Help. !!
thanx
Pashi
 
Chris Baron
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pashi
<body onUnload="window.open( ' ', ' ', ' ' )">
but if you pop up advertising, better use
<body onLoad="history.back()">
[ May 08, 2003: Message edited by: Christian Baron ]
 
Pashi Soni
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx now it is working perfectly.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey have you tried to use a link on your page that you have this code on??? LOL...I would do it if I were you!
 
reply
    Bookmark Topic Watch Topic
  • New Topic