将刷新请求发送到浏览器中打开的另一个页面 [英] Send a refresh request to another page opened in the browser

查看:89
本文介绍了将刷新请求发送到浏览器中打开的另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面A,它创建一个带有页面B的窗口。

I have page A that creates a window with the page B.

页面B询问用户一些数据,将它们插入数据库然后自行关闭。
插入之后,我正在尝试自动刷新页面A(既可以是A看到B已经关闭,也可以是B自身在关闭之前(或之后)触发的功能)

Page B asks the user some datas, inserts them in the database and then closes itself. After the insertion, I'm trying to make page A refresh automatically (it can be both from A seeing that B has closed, or by a function triggered by B itself before (or after?) closing)

我该怎么做?

推荐答案

JavaScript的 window.open()返回对打开窗口实例的引用。您可以使用它来设置 onunload 事件处理程序,如下所示:

JavaScript's window.open() returns reference to the instance of opened window. You may use it to set up onunload event handler, like this:

var hWndB = window.open('somepage.php'),
    hWndA = window.self;

hWndB.onunload = function(){ hWndA.location.reload(); }

这篇关于将刷新请求发送到浏览器中打开的另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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