获取参考现有的浏览器窗口 [英] Obtain reference to existing browser window

查看:153
本文介绍了获取参考现有的浏览器窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我99%肯定的回答我的问题就没有,但以防万一...

I'm 99% sure that the answer to my question will be no but just in case...

使用情况:


  1. 网页中打开使用JavaScript(同一域)
  2. 一个新的窗口b。
  3. 用户刷新A或导航离开,然后返回

  4. 在网页A链接用户点击它应该关闭B

  1. Webpage A opens a new window B with JavaScript (same domain)
  2. The user refreshes A or navigates away and then returns
  3. The user clicks on a link in page A which should close B

这通过,只要用户不刷新,从A(步骤2)导航客场持有窗口参考工作正常。

This works fine by holding on to the window reference as long as the user does not refresh and navigates away from A (step 2).

是否有任何(外来与否)的方式返回到何时重新获得pviously打开的窗口中(S)引用了$ P $?

Is there any (exotic or not) way to re-obtain the reference to the previously opened window(s) when returning to A?

推荐答案

function openWin() {
  w = window.open("","windowname"); // use the window name you gave it when you opened it
  if (w && !w.closed) ...
}

这篇关于获取参考现有的浏览器窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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