471,049 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,049 software developers and data experts.

Popup window will not close on IE6 XP_SP2 after postback

Hello,

We have an application that we have written using ASP.NET. On one of our
pages we open a popup window using javascript. The popup window has a save
and a cancel button. Both of them are server-side controls and do a
postback. While processing on the server we add javascript to the page load
(i.e. onload=window.opener.focus(); window.close()). However, the
window.close() command does not close the IE popup window.

This happens on both Internet and Local Intranet net zones.

We have tried adjusting the security settings all the way down to low and it
has no effect.

Can anyone help to shed some light on why this is not working.

Thank you in advance for your assistance.

Sincerely,
Drew Berkemeyer

Nov 18 '05 #1
7 2473
Not sure if this is relevant, but try: http://aspalliance.com/333 for
closing non-scripted windows (yours sounds scripted, but can't tell from your
note if "opener" is set right).

"Drew Berkemeyer" wrote:
Hello,

We have an application that we have written using ASP.NET. On one of our
pages we open a popup window using javascript. The popup window has a save
and a cancel button. Both of them are server-side controls and do a
postback. While processing on the server we add javascript to the page load
(i.e. onload=window.opener.focus(); window.close()). However, the
window.close() command does not close the IE popup window.

This happens on both Internet and Local Intranet net zones.

We have tried adjusting the security settings all the way down to low and it
has no effect.

Can anyone help to shed some light on why this is not working.

Thank you in advance for your assistance.

Sincerely,
Drew Berkemeyer

Nov 18 '05 #2
try window.opener.close().

I don't understand why you use a server side window instead of a simple
confirm in javascript.

"Drew Berkemeyer" <sp**@menow.com> ha scritto nel messaggio
news:ed**************@TK2MSFTNGP14.phx.gbl...
Hello,

We have an application that we have written using ASP.NET. On one of our
pages we open a popup window using javascript. The popup window has a save
and a cancel button. Both of them are server-side controls and do a
postback. While processing on the server we add javascript to the page
load
(i.e. onload=window.opener.focus(); window.close()). However, the
window.close() command does not close the IE popup window.

This happens on both Internet and Local Intranet net zones.

We have tried adjusting the security settings all the way down to low and
it
has no effect.

Can anyone help to shed some light on why this is not working.

Thank you in advance for your assistance.

Sincerely,
Drew Berkemeyer

Nov 18 '05 #3
Hi Drew,

As for the problem you mentioned, I've performed a simple test on my local
side. I use a XP Pro machine with SP2 installed and IE6. It seems that I
can close the popup window correctly via the script you provided. I'm
thinking there maybe something else which block the popup window from
closing. Is this problem occuring on many other machines on your side?
Anyway, here is the test pages I used, you may also have a try on your
side to see whether it'll return the same result:

============opener window===============
<body>
<form id="Form1" method="post" runat="server">
<table width="100%" align="center">
<TR>
<TD><input type="button" value="popup"
onclick="window.open('popuppage.aspx');"/></TD>
</TR>
.................

==============popuppage.aspx=============
<HTML>
<HEAD>
<title>popuppage</title>
</HEAD>
<body runat="server" id="mybody">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 8px; POSITION:
absolute; TOP: 8px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
</HTML>
===========popuppage codebehind=========
private void Button1_Click(object sender, System.EventArgs e)
{
Page.RegisterStartupScript("closescript","<script
language='javascript'>window.opener.focus(); window.close();</script>");
}

If there is any othe new findings, please also feel free to post here.
Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Nov 18 '05 #4
OK. This is *very* similar to what we are doing.

I've created a new project that just includes the code you posted and it
works on my machine also. I will now try and narrow down the differences and
then post what I find.

*THANK YOU* very much for your timely response. It is greatly appreciated.

Sincerely,
Drew Berkemeyer

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:83**************@cpmsftngxa10.phx.gbl...
Hi Drew,

As for the problem you mentioned, I've performed a simple test on my local
side. I use a XP Pro machine with SP2 installed and IE6. It seems that I
can close the popup window correctly via the script you provided. I'm
thinking there maybe something else which block the popup window from
closing. Is this problem occuring on many other machines on your side?
Anyway, here is the test pages I used, you may also have a try on your
side to see whether it'll return the same result:

============opener window===============
<body>
<form id="Form1" method="post" runat="server">
<table width="100%" align="center">
<TR>
<TD><input type="button" value="popup"
onclick="window.open('popuppage.aspx');"/></TD>
</TR>
................

==============popuppage.aspx=============
<HTML>
<HEAD>
<title>popuppage</title>
</HEAD>
<body runat="server" id="mybody">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 8px; POSITION:
absolute; TOP: 8px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
</HTML>
===========popuppage codebehind=========
private void Button1_Click(object sender, System.EventArgs e)
{
Page.RegisterStartupScript("closescript","<script
language='javascript'>window.opener.focus(); window.close();</script>");
}

If there is any othe new findings, please also feel free to post here.
Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #5
OK. It's fixed.

Here was the problem:

Our orginal code had a syntax error that appearantly only shows up under XP
SP2 as we do not have any problems with any other OS.

The original code looked like this:
strScript += "window.opener.focus();"
strScript += "onload=window.close " ' Note the lack of parens and
semicolon
strScript += "</SCRIPT>"

When I changed it to match your example:
strScript += "window.opener.focus();"
strScript += "window.close();"
strScript += "</SCRIPT>"

It works like a champ!

Thank you again for all of your assistance. Your example gave me what I
needed to solve this quickly.

Sincerely,
Drew Berkemeyer

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:83**************@cpmsftngxa10.phx.gbl...
Hi Drew,

As for the problem you mentioned, I've performed a simple test on my local
side. I use a XP Pro machine with SP2 installed and IE6. It seems that I
can close the popup window correctly via the script you provided. I'm
thinking there maybe something else which block the popup window from
closing. Is this problem occuring on many other machines on your side?
Anyway, here is the test pages I used, you may also have a try on your
side to see whether it'll return the same result:

============opener window===============
<body>
<form id="Form1" method="post" runat="server">
<table width="100%" align="center">
<TR>
<TD><input type="button" value="popup"
onclick="window.open('popuppage.aspx');"/></TD>
</TR>
................

==============popuppage.aspx=============
<HTML>
<HEAD>
<title>popuppage</title>
</HEAD>
<body runat="server" id="mybody">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 8px; POSITION:
absolute; TOP: 8px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
</HTML>
===========popuppage codebehind=========
private void Button1_Click(object sender, System.EventArgs e)
{
Page.RegisterStartupScript("closescript","<script
language='javascript'>window.opener.focus(); window.close();</script>");
}

If there is any othe new findings, please also feel free to post here.
Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6
Hi

A window opened by your app ( window.open ) should have no
problem closing with script... for others user will get a confirm on close
window

--
Best Regards
Vidar Petursson
==============================
Microsoft Visual: Scripting MVP 2000-2004
http://www.icysoft.com/
http://www.deus-x.com/ Instant e-commerce
http://www.microsoft.com/technet/scriptcenter/
Playground: http://213.190.104.211/ ( IE 5.5+ only )

No matter where you go there you are
==============================
"Cirrosi" <Ci****************@fastwebnet.it> wrote in message
news:07******************@tornado.fastwebnet.it...
try window.opener.close().

I don't understand why you use a server side window instead of a simple
confirm in javascript.

"Drew Berkemeyer" <sp**@menow.com> ha scritto nel messaggio
news:ed**************@TK2MSFTNGP14.phx.gbl...
Hello,

We have an application that we have written using ASP.NET. On one of our
pages we open a popup window using javascript. The popup window has a
save
and a cancel button. Both of them are server-side controls and do a
postback. While processing on the server we add javascript to the page
load
(i.e. onload=window.opener.focus(); window.close()). However, the
window.close() command does not close the IE popup window.

This happens on both Internet and Local Intranet net zones.

We have tried adjusting the security settings all the way down to low and
it
has no effect.

Can anyone help to shed some light on why this is not working.

Thank you in advance for your assistance.

Sincerely,
Drew Berkemeyer


Nov 18 '05 #7
Hi Drew,

Thanks for your followup. I'm also very glad that the problem has been
figured out and my suggestions are of assistance. Please feel free to post
here when you need our help. Have a good day!
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by HarveyB | last post: by
4 posts views Thread by SteveS | last post: by
20 posts views Thread by ruca | last post: by
3 posts views Thread by EMW | last post: by
1 post views Thread by Sanjeev Mahajan via .NET 247 | last post: by
8 posts views Thread by JJ | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.