如何关闭在注销所有的子页面 [英] How to close all the child pages on LogOut

查看:98
本文介绍了如何关闭在注销所有的子页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个母版页,并在其中一些孩子pages.One是window.open function.The问题弹出当用户点击在主Page.whole系统注销被重定向到登录页面,除了弹出window.when我点击该子页面然后它会重定向到登录Page.We需要它被注销后直接关闭是pressed。

We have a Master page and some child pages.One in them is popup by window.open function.The problem occurs When logout is clicked at Master Page.whole System is redirect to Login page except that Popup window.when i clicked on that child-page then it will redirected to Login Page.We need it be closed directly after logout is pressed.

是否有任何脚本关闭窗口,如果窗口的位置是known.I要关闭子页中点击注销。
像window.close('Authentication.aspx');
请告诉我,如果可能的话

Is there any script to close window if the window's location is known.I want to close that child page in Logout click. like window.close('Authentication.aspx'); please tell me if it is possible

谢谢,
拉克什。

Thanks , Rakesh.

推荐答案

如果您已经使用以下code打开一个弹出窗口,以popupwindow一presumed名称...

If you've opened a popup window using the following code, with a presumed name of "popupwindow"...

window.open("myurl.html", "popupwindow", "height, etc");

然后在你的登录页面尝试下面的JavaScript

Then in your login page try the following javascript

if(window.name=="popupwindow"){
  window.close();
}

更新基于OP留言...

如果你不再有窗口的引用(因为父窗口刷新为例),那么我认为这几乎是不可能的检测具有特定名称的弹出窗口是否存在。

If you no longer have a reference to the window (because the parent window has refreshed for example), then I believe it is almost impossible to detect whether a popup window with a particular name exists or not.

我说几乎不可能,因为在这种情况下,一种选择是尝试打开再次给人一种空白的URL窗口。如果窗口已经存在,则该窗口将保持相同的页面之前,但现在你必须对它的引用,并可以根据需要关闭。

I say "almost impossible" because one option in this situation is to try opening the window again giving a blank URL. If the window already exists, then the window will remain on the same page as before, but now you have a reference to it, and can close as necessary.

var myWin = window.open("","popupwindow");
myWin.close();

然而,在缺点这种是,如果窗口没有的不可以存在,用户会看到打开一个空白窗口,然后在关闭之前 - 所以不是一个很好的用户 - 体验。

However, the downside to this is that if the window does not exist, the user will see a blank window open before then being closed - so not a nice user-experience.

这篇关于如何关闭在注销所有的子页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆