473,395 Members | 2,437 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,395 software developers and data experts.

How to close all windows in a web application?

Hi I have a web application that has a log off selection, just redirects the
browser to a form with a label displaying you are loging off. In part of the
application I open a new window and was wondering if there is a way to close
all windows associated with the web application when the user selects the log
off selection?
Thanks.
--
Paul G
Software engineer.
Nov 18 '05 #1
7 3030
Just create an array of variable that holds the handle returned by your
calls to window.open(). Then use it to close accordingly.

e.g.:
function openwin() {
fhandle = window.open("popup.aspx");
}

function closewin() {
fhandle.close();
}

"Paul" <Pa**@discussions.microsoft.com> 在郵件
news:C9**********************************@microsof t.com 中撰寫...
Hi I have a web application that has a log off selection, just redirects the browser to a form with a label displaying you are loging off. In part of the application I open a new window and was wondering if there is a way to close all windows associated with the web application when the user selects the log off selection?
Thanks.
--
Paul G
Software engineer.

Nov 18 '05 #2
Thanks for the information, just wondering if you know what event to use if
aparent different aspx file is loaded into the web window, say with a
hyperlink as I want to close another window when this takes place?

"Lau Lei Cheong" wrote:
Just create an array of variable that holds the handle returned by your
calls to window.open(). Then use it to close accordingly.

e.g.:
function openwin() {
fhandle = window.open("popup.aspx");
}

function closewin() {
fhandle.close();
}

"Paul" <Pa**@discussions.microsoft.com> 礎b繞l瞼籀
news:C9**********************************@microsof t.com 瞻瞻翹繞翹g...
Hi I have a web application that has a log off selection, just redirects

the
browser to a form with a label displaying you are loging off. In part of

the
application I open a new window and was wondering if there is a way to

close
all windows associated with the web application when the user selects the

log
off selection?
Thanks.
--
Paul G
Software engineer.


Nov 18 '05 #3
Vik
How can I get a handle of a browser window which is opened by a user through
the browser menu?

Thanks.

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uB**************@tk2msftngp13.phx.gbl...
Just create an array of variable that holds the handle returned by your
calls to window.open(). Then use it to close accordingly.

e.g.:
function openwin() {
fhandle = window.open("popup.aspx");
}

function closewin() {
fhandle.close();
}

"Paul" <Pa**@discussions.microsoft.com> 在郵件
news:C9**********************************@microsof t.com 中撰寫...
Hi I have a web application that has a log off selection, just redirects the
browser to a form with a label displaying you are loging off. In part

of the
application I open a new window and was wondering if there is a way to close
all windows associated with the web application when the user selects

the log
off selection?
Thanks.
--
Paul G
Software engineer.


Nov 18 '05 #4
I set up this below as lau suggested, and it the functions seem to work. So
the handle for the window that displays control_numifno.aspx is win_usr.
<script language="javascript">
function openwin(){
win_usr=window.open ("control_numinfo.aspx")
}
function closewin(){
win_usr.close();
}

"Vik" wrote:
How can I get a handle of a browser window which is opened by a user through
the browser menu?

Thanks.

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uB**************@tk2msftngp13.phx.gbl...
Just create an array of variable that holds the handle returned by your
calls to window.open(). Then use it to close accordingly.

e.g.:
function openwin() {
fhandle = window.open("popup.aspx");
}

function closewin() {
fhandle.close();
}

"Paul" <Pa**@discussions.microsoft.com> 礎b繞l瞼籀
news:C9**********************************@microsof t.com 瞻瞻翹繞翹g...
Hi I have a web application that has a log off selection, just redirects

the
browser to a form with a label displaying you are loging off. In part

of
the
application I open a new window and was wondering if there is a way to

close
all windows associated with the web application when the user selects

the
log
off selection?
Thanks.
--
Paul G
Software engineer.



Nov 18 '05 #5
There are many ways. But the following is the one I preferred.

Add another server-side hidden textbox named "hid_func". The script for
opening window should set it to "hwndsav" then call click() on a server-side
button. When the server-side button handler see hid_func.Text == "hwndsav",
it knows it should save the handle and then set it's value to "" again. In
this fashion you can implement other client-server side interaction using
this single button.

"Paul" <Pa**@discussions.microsoft.com> 在郵件
news:45**********************************@microsof t.com 中撰寫...
Thanks for the information, just wondering if you know what event to use if aparent different aspx file is loaded into the web window, say with a
hyperlink as I want to close another window when this takes place?

"Lau Lei Cheong" wrote:
Just create an array of variable that holds the handle returned by your
calls to window.open(). Then use it to close accordingly.

e.g.:
function openwin() {
fhandle = window.open("popup.aspx");
}

function closewin() {
fhandle.close();
}

"Paul" <Pa**@discussions.microsoft.com> |b?l¥o
news:C9**********************************@microsof t.com ?????g...
Hi I have a web application that has a log off selection, just
redirects the
browser to a form with a label displaying you are loging off. In part
of the
application I open a new window and was wondering if there is a way to

close
all windows associated with the web application when the user selects
the log
off selection?
Thanks.
--
Paul G
Software engineer.


Nov 18 '05 #6
Vik
In your example, the new window is open by code. What I need to know is a
handle for the new window opened by a user through the browser menu
File->New->Window.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
I set up this below as lau suggested, and it the functions seem to work. So the handle for the window that displays control_numifno.aspx is win_usr.
<script language="javascript">
function openwin(){
win_usr=window.open ("control_numinfo.aspx")
}
function closewin(){
win_usr.close();
}

"Vik" wrote:
How can I get a handle of a browser window which is opened by a user through the browser menu?

Thanks.

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uB**************@tk2msftngp13.phx.gbl...
Just create an array of variable that holds the handle returned by your calls to window.open(). Then use it to close accordingly.

e.g.:
function openwin() {
fhandle = window.open("popup.aspx");
}

function closewin() {
fhandle.close();
}

"Paul" <Pa**@discussions.microsoft.com> bl?o
news:C9**********************************@microsof t.com ????g...
> Hi I have a web application that has a log off selection, just redirects the
> browser to a form with a label displaying you are loging off. In part
of
the
> application I open a new window and was wondering if there is a way
to close
> all windows associated with the web application when the user

selects the
log
> off selection?
> Thanks.
> --
> Paul G
> Software engineer.


Nov 18 '05 #7
The fact is: You simply can't alter things that is not within your current
scope of DOM model.

Since the window opened using "File"->"New"->"Window" is not opened by your
script, you has no reference/handle/access to it and cannot close it. By
enabling the script to do so is in fact violating the security measure of
the browser. (Since maybe one window is opening pages in internet zone and
another is opening pages in local zone, if I can manipulate other window
then maybe I'm possible to execute malicious ActiveX controls on the client.
The best way to prevent this is to block access from your script to it.)

For example, you're assured when you checking your email through webmail,
the other pages you're visiting cannot see the content of your email. (Or is
it so? Maybe someone have trick to get through it. Also, I can't remember
whether cookies can be shared over windows opened by this method.)

"Vik" <viktorum@==hotmail.com==> 在郵件
news:eZ**************@TK2MSFTNGP10.phx.gbl 中撰寫...
In your example, the new window is open by code. What I need to know is a
handle for the new window opened by a user through the browser menu
File->New->Window.

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
I set up this below as lau suggested, and it the functions seem to work. So
the handle for the window that displays control_numifno.aspx is win_usr.
<script language="javascript">
function openwin(){
win_usr=window.open ("control_numinfo.aspx")
}
function closewin(){
win_usr.close();
}

"Vik" wrote:
How can I get a handle of a browser window which is opened by a user through the browser menu?

Thanks.

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uB**************@tk2msftngp13.phx.gbl...
> Just create an array of variable that holds the handle returned by your > calls to window.open(). Then use it to close accordingly.
>
> e.g.:
> function openwin() {
> fhandle = window.open("popup.aspx");
> }
>
> function closewin() {
> fhandle.close();
> }
>
> "Paul" <Pa**@discussions.microsoft.com> bl?o
> news:C9**********************************@microsof t.com ????g...
> > Hi I have a web application that has a log off selection, just redirects > the
> > browser to a form with a label displaying you are loging off. In part of
> the
> > application I open a new window and was wondering if there is a
way to > close
> > all windows associated with the web application when the user selects the
> log
> > off selection?
> > Thanks.
> > --
> > Paul G
> > Software engineer.
>
>


Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Guy Babbitt | last post by:
I have an MDI application that starts an instance of a child form at application start. I have an event handler on a combo box checking for the selected value to change. When the select value...
1
by: Ebrahim | last post by:
This message is in reply to a prev 1 . My application refues to close . Some one had suggested that I might have threads running.. but i solved that problem too . The app still refuses to close...
1
by: Alpha | last post by:
I have a Window based application that shows up still running in the task manager when I close it. It reaches the "this.close" statement and then it stops at the "}" at the section of the...
4
by: Alpha | last post by:
I have a window Application. this.close(); doesn't stop and close my application when I get an error. Instead it continues trying to execute the following codes. What code do I need to the...
3
by: Gary | last post by:
Hi, I have my main form1 and I want to close it and then show form2, in VB6 I used the following code... unload me form2.show in VB.net I got this far
35
by: Eric Sabine | last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET connection object, SQLConnection to be exact) and then I came across the following in some microsoft code. If Not cn Is Nothing...
5
by: Eric Renken | last post by:
OK, I have a form with a menu and a tool bar. In the Menu I have a File menu that contains a "Exit" item. When I click this Exit item. I have an event wired to: mnuFile.DropDown.ItemClicked ...
3
by: Karan | last post by:
I am calling finalize when form2 loads and deactivates form1 which closes form1. However, same thing is not happening in form2 because finalize is already called. Does anybody has solution to it....
0
by: Mark Gold | last post by:
Hi! We have a VB application using Crystal Reports 6 that has worked successfully on hundreds of systems for over 10 years. Now, on one network, the application and access database does not close....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

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.