views:

335

answers:

2

I have an aspx.cs page with the following code:

hypPopup.Attributes.Add("onclick",
                        "window.open('Popup.aspx',
                        '',
                        'height=650,
                         width=800,
                         location=no,
                         toolbar=no, 
                         status=no, 
                         scrollbars=yes, 
                         resizable=yes');
                         return false"
                         );

When I click the hypPopup link, the window pops up which is fine, but if I close it and refresh the page, the popup keeps popping up. I have to leave the page and come back for it to stop popping up on every refresh. Is this behavior by default or is there a fix to it?

hypPopup.Attributes.Add is done in the Page_Load

A: 

If the hypPopup button is set to run on the server, try removing that. Maybe its causing a repost and something int hat repost triggers the button click, so when you refresh the page its resimulating the repost and the click?

I don't know... just trying to think of something!

rally25rs
A: 

I have tested this using both <asp:Hyperlink> and <asp:LinkButton> on both Firefox 3.0.6 and IE 6, neither of which reproduce this sort of behavior. The popup window will not appear if I refresh the page (which is in fact the desired behavior since client-side events should only be fired by specific client-side actions.)

What browser are you using? Is that the exact code being fired, or is there more to it then what is displayed?

John Rasch