1

I use web application

From my main application,I opened child window C1 and again opened another child window C2 from C1. If i close the the C1 window, I'm not able to find the top most main application.

Actually i wanted to redirect the Main application to different page if a hyperlink is clicked on the child window.This is working good until i close C1 which is a parent of C2

Any help is greatly appreciated

4

1 回答 1

0

@Mey,如果没有看到您的代码的好处,就很难确定您的问题是什么。也就是说,window.top是对最顶层窗口的引用。所有主要浏览器似乎都支持它(请参阅此处)。

你是绝对正确的。这不适用于由window.open(). 这个解决方案怎么样:让打开窗口在打开的窗口上设置一个属性,以便在打开后立即跟踪最顶部的窗口。这样,如果任何中间窗口关闭,则打开的窗口已经具有对最顶层窗口的引用。让我告诉你我的意思。

从最顶部的窗口:

var c1 = window.open(...);
c1.window.topMost = window;

从第一个弹出窗口: c1

var c2 = window.open(...);
c2.window.topMost = window.topMost;

从第二个弹出窗口: c2

var c3 = window.open(...);
c3.window.topMost = window.topMost;

现在,假设您关闭c1or c2c3仍然会引用window.topMost

于 2014-09-19T15:08:53.357 回答