Forum Moderators: open

Message Too Old, No Replies

Open New Window When Pop-up Closed

         

boxfan

10:28 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



Hello,

I have a live chat application and when the user closes the chat window either by clicking on the X in the corner of the chat window or clicking on the close window link I want a new pop-up window to open with a customer survey.

So I guess I need to detect if a child window has been closed and if so then open a new child window with the survey.

I've tried this

function OpenWin(){
popup=window.open('survey.html', 'result', 'scrollbars,resizable,width=640,height=480')
}

function ifclosed() {
if (window.close) {
alert("closing")
OpenWin()
}
}

body onunload="ifclosed()

But I'm not getting anywhere...

Any ideas?

Dabrowski

10:49 am on Apr 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why do you have if( window.close)? This event should only be fired if the document is unloaded, i.e. window closed OR moved to any new page, so you shouldn't need it.

boxfan

3:23 pm on Apr 11, 2007 (gmt 0)

10+ Year Member



I removed the if (window.close) { } but it still does not open another pop-up window. I do get the alert that the window was closed.