移动浏览器中的window.close()无法正常工作 [英] window.close() in Mobile Browser not working

查看:55
本文介绍了移动浏览器中的window.close()无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有其他方法可以使用JS关闭当前标签页?因为window.close()在移动浏览器上不起作用

Is there an alternative way to close current tab using JS ? because window.close() is not working on Mobile browsers

推荐答案

我遇到了同样的问题,我尝试了很多方法,但是没有一种方法能够适应所有设备.最后,我使用以下代码,我确实没有更好的方法.

I have the same issue, i tried a lot of ways, but none can adapt to all devices. At last, I use the follow code, I really have no better way.

window.opener=null;
window.open('','_self');
window.close();
window.history.go(-1);
$(document.body).hide()

这篇关于移动浏览器中的window.close()无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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