Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   How to close all windows in a web application? (http://www.velocityreviews.com/forums/t91328-how-to-close-all-windows-in-a-web-application.html)

=?Utf-8?B?UGF1bA==?= 11-22-2004 10:45 PM

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.

Lau Lei Cheong 11-23-2004 01:20 AM

Re: How to close all windows in a web application?
 
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" <Paul@discussions.microsoft.com> 在郵件
news:C94DE2C9-EA08-4C2B-83D8-CCF52F690487@microsoft.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.




=?Utf-8?B?UGF1bA==?= 11-23-2004 08:49 PM

Re: How to close all windows in a web application?
 
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" <Paul@discussions.microsoft.com> 礎b繞l瞼籀
> news:C94DE2C9-EA08-4C2B-83D8-CCF52F690487@microsoft.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.

>
>
>


Vik 11-23-2004 09:55 PM

Re: How to close all windows in a web application?
 
How can I get a handle of a browser window which is opened by a user through
the browser menu?

Thanks.

"Lau Lei Cheong" <leu_lc@yehoo.com.hk> wrote in message
news:uBPekqP0EHA.2040@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" <Paul@discussions.microsoft.com> 在郵件
> news:C94DE2C9-EA08-4C2B-83D8-CCF52F690487@microsoft.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.

>
>




=?Utf-8?B?UGF1bA==?= 11-23-2004 10:33 PM

Re: How to close all windows in a web application?
 
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" <leu_lc@yehoo.com.hk> wrote in message
> news:uBPekqP0EHA.2040@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" <Paul@discussions.microsoft.com> 礎b繞l瞼籀
> > news:C94DE2C9-EA08-4C2B-83D8-CCF52F690487@microsoft.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.

> >
> >

>
>
>


Lau Lei Cheong 11-24-2004 01:22 AM

Re: How to close all windows in a web application?
 
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" <Paul@discussions.microsoft.com> 在郵件
news:45E8AF89-A227-4E2B-8064-C7F537C71604@microsoft.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" <Paul@discussions.microsoft.com> |b?l¥o
> > news:C94DE2C9-EA08-4C2B-83D8-CCF52F690487@microsoft.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.

> >
> >
> >




Vik 11-24-2004 02:41 PM

Re: How to close all windows in a web application?
 
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" <Paul@discussions.microsoft.com> wrote in message
news:981BF419-B447-4B71-A1BC-5352C669A4FD@microsoft.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" <leu_lc@yehoo.com.hk> wrote in message
> > news:uBPekqP0EHA.2040@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" <Paul@discussions.microsoft.com> bl?o
> > > news:C94DE2C9-EA08-4C2B-83D8-CCF52F690487@microsoft.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.
> > >
> > >

> >
> >
> >




Lau Lei Cheong 11-25-2004 08:12 AM

Re: How to close all windows in a web application?
 
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:eZoILOj0EHA.1408@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" <Paul@discussions.microsoft.com> wrote in message
> news:981BF419-B447-4B71-A1BC-5352C669A4FD@microsoft.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" <leu_lc@yehoo.com.hk> wrote in message
> > > news:uBPekqP0EHA.2040@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" <Paul@discussions.microsoft.com> bl?o
> > > > news:C94DE2C9-EA08-4C2B-83D8-CCF52F690487@microsoft.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.
> > > >
> > > >
> > >
> > >
> > >

>
>





All times are GMT. The time now is 01:47 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57