window.close()在Windows Phone IE上不起作用 [英] window.close() doesn't work on windows phone IE
问题描述
window.close()在使用IE的Windows手机上不起作用。
window.close() doesn't work on windows phone with IE.
打开选项卡:target =_ blank我尝试关闭它使用以下代码:
The tab is opened with :target="_blank" and i try to close it with the following code:
<div onclick="window.close();"></div>
我在Windows 8.1上尝试使用IE 11,确认消息后,它没有错误地工作。
I tried on IE 11 on windows 8.1 and it worked, without errors, after confirm message.
我尝试在Windows手机模拟器上使用Lumia 925,但它无效。页面仍然打开。
I tried on Lumia 925, on windows phone emulator, and it didn't work. The page remains open.
我做了以下测试页:
http://www.qualcosadafare.it/test/test/anp.php
有什么想法吗?
谢谢。
推荐答案
移动IE仅使用一个选项卡。当您使用 target =_ blank
时,您实际上没有打开新选项卡,而是在当前选项卡中打开它。你无能为力。
Mobile IE only uses one tab. When you use target="_blank"
you actually aren't opening a new tab, you are opening it in the current tab. There isn't much you can do about this.
您可能做的最好的事情是检测用户是否使用IE:
Probably the best thing you might be able to do is detect if the user is using 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
}
这篇关于window.close()在Windows Phone IE上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!