Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

windows.open onUnload

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
0
0
GB
Hi,

I've made a calendar that uses popups - eg you click on the date and that opens a new smaller window that lets you enter information.

I want to make it so if the user closes the popup with the X at the top right rather than clicking on my Finished button which does other stuff like email the organiser, the parent window redirects to a warning page telling you that is what has happened.

So far I've got

<body onunload="parent.window.open('warning.asp');">

But this doesn't seem to be working. I know there are some limitations on using window.open in conjunction with unload ie to stop dodgy sites effectively hijacking a user's PC with popups that they can't get rid of, but is there a decent way round this?

Thanks very much

Ed
 
but is there a decent way round this

The best way is to scrap the popup boxes completely and use absolutely positioned divs instead. That way you don't run into any of that mess. It's gonna cause you to have to completely redesign the whole thing, more than likely - however, it is what I (and many others) consider the "right" way of doing it.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
I could go down this route as this would mean I don't have to tell people how to configure their popup blocker and it would fix this problem.

Is there a good example anywhere of having some a <div> with dynamic content that can be opened and hidden with hyperlinks?

Thanks

Ed
 
Search google for "javascript modal div"

Splash in some ajax and then you'll get a pretty slick interface.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Here's a decent implementation that you might wanna try out:


-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top