Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript';onunload&x27;事件在最新版本中不起作用';54.0.2840.71米';谷歌Chrome浏览器的应用_Javascript_Google Chrome_Onunload_Window.onunload - Fatal编程技术网

Javascript';onunload&x27;事件在最新版本中不起作用';54.0.2840.71米';谷歌Chrome浏览器的应用

Javascript';onunload&x27;事件在最新版本中不起作用';54.0.2840.71米';谷歌Chrome浏览器的应用,javascript,google-chrome,onunload,window.onunload,Javascript,Google Chrome,Onunload,Window.onunload,最近,我将我的Google Chrome浏览器更新为版本“54.0.2840.71 m”,突然javascript“onUnload”事件停止工作。我敢肯定,它在升级之前工作得很好 在我的代码(如下所述)中,我试图从“父”窗口打开“子”窗口,当子窗口关闭/刷新时(即当其卸载事件被触发时),它也应该重新加载或刷新父窗口 parent.html文件的源代码: <!DOCTYPE html> <html lang="en"> <head> &

最近,我将我的Google Chrome浏览器更新为版本“54.0.2840.71 m”,突然javascript“onUnload”事件停止工作。我敢肯定,它在升级之前工作得很好

在我的代码(如下所述)中,我试图从“父”窗口打开“子”窗口,当子窗口关闭/刷新时(即当其卸载事件被触发时),它也应该重新加载或刷新父窗口

parent.html文件的源代码:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Parent Page</title>
    </head>
    <body>
        This is parent page. Click <a href="#" onClick="window.open('child.html', '_blank', 'toolbar=no,scrollbars=yes,resizable=no,top=150,left=250,width=500,height=500'); return false;">here</a> to open the child page.
    </body>
</html>
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Child Page</title>
        <script type="text/javascript">
            window.onunload = refreshParent;
            function refreshParent() {
                window.opener.location.reload();
            }
        </script>
    </head> 
    <body>
        This is child page.
    </body>
</html>

父页
这是父页面。单击以打开子页面。
child.html文件的源代码:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Parent Page</title>
    </head>
    <body>
        This is parent page. Click <a href="#" onClick="window.open('child.html', '_blank', 'toolbar=no,scrollbars=yes,resizable=no,top=150,left=250,width=500,height=500'); return false;">here</a> to open the child page.
    </body>
</html>
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Child Page</title>
        <script type="text/javascript">
            window.onunload = refreshParent;
            function refreshParent() {
                window.opener.location.reload();
            }
        </script>
    </head> 
    <body>
        This is child page.
    </body>
</html>

子页面
window.onunload=refreshParent;
函数refreshParent(){
window.opener.location.reload();
}
这是子页面。
这段代码在“Internet Explorer”和“Mozilla Firefox”浏览器中都能正常工作,在“Google Chrome”的早期版本中也能正常工作,但在其最新版本中不能正常工作

如果我做错了什么,请告诉我


谢谢和问候

我猜该事件实际上已被调用(因为我可以添加断点并在其中执行其他任何操作),而window.opener.location.reload()正被此提交忽略/阻止:


我也创建了一个bug(),因为我担心您的bug会因为前面提到的差异而关闭。

已确认,它不起作用,但是,无法找到任何关于为何突然被阻止的明确信息。非常感谢@WiktorZychla的确认。我已经用Chromium报告了这个问题,它可以在.Yes@hanleym上找到,这似乎确实是这样,因为放置了一个“console.log(“Child Window Closed”);”“onUnload”事件中的语句正在工作。只是父窗口没有刷新,控制台显示一个异常,上面写着“Uncaught DomeException:阻止原点为“null”的帧访问跨原点帧”