问题与window.close和铬 [英] Issue with window.close and chrome

查看:108
本文介绍了问题与window.close和铬的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是什么即时通讯使用

$

我试图关闭一个窗口与JavaScript和Firefox中的一切正常,但在铬窗口不关闭b
$ b

  $(document).ready(function(){
if(window.opener&&!window.opener.closed)
window.opener.location =http://www.website.com
window.close();
});

我在 google ,但无济于事。

任何人有类似的问题或知道的解决方法?

解决方案

我知道这个问题是旧的,但我遇到同样的问题。这对我有用:

  window.open('','_self',''); //错误修正
window.close();


Im trying to close a child window with javascript and in firefox everything works fine but in chrome the window doesnt close

here is what im using

$(document).ready(function() {
    if (window.opener && !window.opener.closed)
        window.opener.location = "http://www.website.com"
    window.close();
});

I tried a suggestion on google, but to no avail.

Anyone having a similar issue or know of a work-around?

解决方案

I know this question is old, but I ran into the same problem. This worked for me:

window.open('', '_self', ''); //bug fix
window.close();

这篇关于问题与window.close和铬的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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