473,416 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 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 2578
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
5
by: Jay | last post by:
I have a situation where the user clicks on a button in a DataGrid to launch a popup window via javascript. In the popup window the user does some things that result in changes to the underlying...
4
by: SteveS | last post by:
Hello. This is a strange problem which does not make sense to me. I open a popup page with the following javascript code: function OpenDenyWindow(changeId) {...
20
by: ruca | last post by:
Hi, DESCRIPTION: I'm developing an application that when I need to insert a date, I use 3 textbox's and one image button. This image button open's a small popup window with a calendar,...
3
by: EMW | last post by:
Hi, Is it possible with VB.NET and Javascript to popup a window, after a buttonclick, in which the user writes some text in a textbox and then when that window is closed with a button, the text...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
1
by: Sanjeev Mahajan via .NET 247 | last post by:
Hi All, I have a main page from which I am calling a popup page. Thepopup page has an editable grid and some other fields. There isalso a Save button on the popup page. When the user clicks...
1
by: Matt Jensen | last post by:
Howdy I've got a ASP.NET webform page that pops up a window for a user to make a selection. Once they make a selection in this popup window, the form in the popup is submitted an update to the...
8
by: JJ | last post by:
Whats the best way to pass a variable from a popup to the current page (without a postback on the current page). I have a form on 'page1' with various text input boxes. One box contains an image...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.