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.
>
>