简体   繁体   English

window.close()在Windows Phone IE上不起作用

[英]window.close() doesn't work on windows phone IE

window.close() doesn't work on windows phone with IE. window.close()在IE手机的Windows手机上不起作用。

The tab is opened with :target="_blank" and i try to close it with the following code: 该选项卡打开:target =“_ blank”,我尝试使用以下代码关闭它:

<div onclick="window.close();"></div>

I tried on IE 11 on windows 8.1 and it worked, without errors, after confirm message. 我在Windows 8.1上尝试了IE 11,确认消息后,它没有错误地工作。

I tried on Lumia 925, on windows phone emulator, and it didn't work. 我尝试在Windows手机模拟器上使用Lumia 925,但它无法正常工作。 The page remains open. 该页面仍然打开。

I made the following test page: 我做了以下测试页面:

http://www.qualcosadafare.it/test/test/anp.php http://www.qualcosadafare.it/test/test/anp.php

Have any idea? 有什么想法吗?

Thanks. 谢谢。

Mobile IE only uses one tab. Mobile IE仅使用一个选项卡。 When you use target="_blank" you actually aren't opening a new tab, you are opening it in the current tab. 当您使用target="_blank"您实际上没有打开新选项卡,而是在当前选项卡中打开它。 There isn't much you can do about this. 你无能为力。

Probably the best thing you might be able to do is detect if the user is using IE: 您可以做的最好的事情可能是检测用户是否使用IE:

function msieversion() {
        var ua = window.navigator.userAgent;
        var msie = ua.indexOf("MSIE ");
        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))
            return true
        else
            return false
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM