javascript - 关闭子页面后无法重新加载页面

标签 javascript html

关闭子页面后无法自动刷新父页面。我知道这个问题以前被问过,但我无法使用它们解决我的问题。以下是我的父页面(parent.php)。

<html>
<head>
<script type="text/javascript">

var popupWindow=null;

function child_open()
{ 

popupWindow =window.open('child_page.html',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200");

}
function parent_disable() {
if(popupWindow && !popupWindow.closed)
popupWindow.focus();
}
</script>

</head>
<body onFocus="parent_disable();" onclick="parent_disable();">
    <a href="javascript:child_open()">Click me</a>
</body>    

</html>

这是我的 child_page.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<h1>child page</h1>

This is the child page
<body>

<script>
    window.onunload = refreshParent;
    function refreshParent() {
        window.opener.location.reload();
    }
</script>
</body>
</html>

最佳答案

这与 Mozilla 完美配合。

关于javascript - 关闭子页面后无法重新加载页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18185990/

相关文章:

javascript - 用变量解析 getJson

javascript - 信用卡验证问题

javascript - 没有 Javascript 的照片库

html - 网格属性不适用于网格容器内的元素

javascript - 在 javascript home 组件中定义 Apex Controller

javascript - 如何使d3折线图中的线条更平滑?

html - 样式为按钮的链接高度不一致

html - 高分辨率图像 IE 浏览器渲染

php - 如何使用 IF 命令在表格中显示不同的信息?

html - 如何在没有跳跃的情况下减慢悬停元素上的 CSS 动画?