Cross browser, self closing popup window
If you want to a cross browser way to have your popup self close
onsomething="window.opener=self;window.close();"
This works in most browsers, but doesn't work in FF 2.0 unless the window was in fact popped up. The window.opener=self fools most browsers, but FF is smarter :-)
I know its bad usability, but the context I used it in, was that a window was popping up a poll. On submitting that poll, the poll popup would close itself and the results on the opener were updated. The code for that is below. I put that code on the submit button onclick. I had to name the opener window in order for it to work. This way if there is an opener, it will try to target "jjCalendar" as the forms target. If that name doesn't exist, it will just open a new window.
onclick="if (window.opener){form.target='jjCalendar';}"
Labels: All, Javascript
0 Comments:
Post a Comment
<< Home