Close multi opener, parent of a web window and redirect to default home page

原创 2007年07月11日 17:37:00

assume default home page is default.aspx, default first page is default.htm.

default.htm:

<script type="text/javascript" language="javascript">
        
<!--            
            setTimeout(
'OpenWin()'100);
            
            
function OpenWin()
            
{
                
if(window.parent != null && window.opener == null)
                
{
                    window.parent.location 
= "Default.aspx";
                }

                
else if(window.opener != null && !window.opener.closed)
                
{
                    window.opener.location 
= "default.htm"// recursion to close opener's opener's opener...
                    window.close();
                }

                
else
                
{
                    window.location 
= "Default.aspx";
                }

            }

        
//-->
    </script>

 

code to redirect to default.htm:

private void ResponseRidirect()
        
{
            
string currentUrl = this.Request.Url.ToString();
            
string appPath = this.Request.ApplicationPath;
            
int index = currentUrl.IndexOf(appPath);
            
string destUrl = string.Format("{0}/default.htm", currentUrl.Substring(0, index + appPath.Length));

            
string script = "<script language="javascript" type="text/javascript"> " +
                
"window.location = "" + destUrl + ""; " +
                
"</script>";
            Response.Write(script);
            Response.End();
        }

 

 

相关文章推荐

html2canvas- Take Screenshot of Web Page and Save It to Server (Javascript and PHP)

转载自:http://www.kubilayerdogan.net/html2canvas-take-screenshot-of-web-page-and-save-it-to-server-java...

to tell something in brief about default init receive window of TCP

the referenced kernel version is 3.10. for linux TCP/IP protocol implementation, while an tcp soc...
  • flxue
  • flxue
  • 2016年06月03日 20:43
  • 666

The Relationship of Parent Window And Sub Window

关于子窗体的层级关系总结一下哈,希望能对大家有些帮助 假设有这样两个窗体:RootWindow,SubWindow,在RootWindow中引发某事件而显示SubWindow 1,如果弹出窗体...

window.parent与window.opener区别介绍

来自:http://www.jb51.net/article/30086.htm 首先来说说 parent.window与top.window的用法  "window.location.href"...

window.opener和window.parent

(转)js操作frame详细解说,window.opener和window.parent的区别(2010-11-11 12:13:29) 转载 标签: frame it ...
  • CPU_2
  • CPU_2
  • 2011年08月31日 23:25
  • 3525

Add custom and listview web part to wiki page using powershell

As we know, Adding list view web part is different from custom web part using powershell, what's mor...

HOW TO Set Up Multi-Server ASP.NET Web Applications and Web Services

This step-by-step article discusses how to set up multi-server ASP.NET Web Applications and Web serv...

Caused by: Unable to locate parent package [json-default] for [class com.you.user.action.StudentActi

1、错误描述 信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.TextParser) 2014-7-13 1:52:04 or...

How can selenium web driver get to know when the new window has opened and then resume its execution

http://stackoverflow.com/questions/9188343/how-can-selenium-web-driver-get-to-know-when-the-new-wind...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Close multi opener, parent of a web window and redirect to default home page
举报原因:
原因补充:

(最多只允许输入30个字)