Forum Moderators: open

Message Too Old, No Replies

Window.Close()

Can you specify document.location if canceled?

         

SteveGold

11:55 am on Jun 9, 2004 (gmt 0)

10+ Year Member



If a user cancels out of the Windows.Close() message box, I want to direct them to a specific page. IS this possible?

Bernard Marx

3:57 pm on Jun 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Simply putting the redirection command straight after seems to work.
Either the window is closed or redirected:


window.close()
location.href = "http://www.webmasterworld.com"

SteveGold

5:19 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



Thanks Bernard Max. I tried window.location and location.href but when the "Cancel" button is clicked, the user get automaticly sent to the orginal login screen which is the default.asp. They then have to log back in again. I would like to send the user back to a menu page instead. Does this make sense?

Bernard Marx

6:32 pm on Jun 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Strange. Could you post the relevant code snippet(s)?

SteveGold

7:12 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



Not a problem, it's pretty basic. A user clicks the "Exit" link. An onClick event calls exitWindow()
function exitWindow() {

window.close()
document.location = 'SSN_Survey_menu.asp'
}
Thanks for responding.

Bernard Marx

9:52 am on Jun 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should work with

window.location.href = "_redirectURL_" // ([b]not[/b] document.)

If it doesn't, I'm afraid I don't know why.