1

I have one icon (say open) in home page. When I click on this icon one child window will be open and the icon in that home page is also changed to 'close icon'. When close this popup window the icon should be same as previous icon (i.e. open icon) in home page. It's working fine when I stay on the same page.

But when redirecting from home page to next page the entire page gets reloaded. And the default image (open icon) is displaying even if the popup window is opened.

Now my requirement is:

  1. At the time of page redirection the image should be loaded based upon the popup window. i.e. if popup window is open it should display the close icon otherwise it display open icon.

  2. If page is refreshed or redirecting to another page the reference of the popup window is removed. then how can I get the reference of that popup window in a redirecting page.

  3. How to count the number of child windows for a browser

EDIT:

I have tried the following solutions:

  1. I set cookie at the time of opening a popup window and reset that cookie whenever I have closed that popup window. But the problem is, at the time of page redirection if I close the popup window the cookie is not reset to it's previous value, because the page is still in processing.

  2. same problem with the session variable also

Please help me.

4

2 回答 2

1

打开和关闭时设置 cookie 或会话变量。这样您就可以在新请求期间记住弹出窗口的状态

于 2012-08-10T10:42:07.327 回答
0

当您从一页转到下一页时,您会丢失对弹出窗口的引用。但弹出窗口不会丢失对主窗口的引用。window.opener 将始终指向打开它的窗口,即使页面发生更改。使用此事实在导航事件后重新建立窗口之间的通信。您可能需要使用间隔函数来探测主窗口,因为我认为您无法监听事件。

于 2012-08-10T11:23:42.703 回答