[英]window.close doesn't work if window is opened as tab (Firefox 47)
var google_login_popup = "";
var social_google_login = function () {
google_login_popup = window.open('www.google.com', "google_popup", 'width=800, height=600');
};
social_google_login();
setTimeout(function() {
google_login_popup.close();
}, 1000);
It opens the popup in a new TAB - not window. 它会在新的TAB中打开弹出窗口 - 而不是窗口。 But .close() doesn't close the window.
但.close()不会关闭窗口。
This should work as the script opening the window is also trying to close it. 这应该工作,因为打开窗口的脚本也试图关闭它。
Note that this only applies for Firefox 47, mobile . 请注意,这仅适用于Firefox 47, 移动版 。
Video: https://www.dropbox.com/s/bqcf8iwm5bsw4yn/VIDEO0254.mp4?dl=0 . 视频: https : //www.dropbox.com/s/bqcf8iwm5bsw4yn/VIDEO0254.mp4?dl = 0 。
I tested this in Firefox 47 on mobile (Android 5.1.1, Moto G) and wasn't able to replicate the behaviour using your code in a skeleton web page. 我在Firefox 47的移动设备(Android 5.1.1,Moto G)上测试了这个,并且无法在骨架网页中使用您的代码复制行为。 However, looking at the video and looking at the code in https://cdn.dorms.com/static/js/social.js there's clearly more going on than just the code you've supplied here on SO.
但是,观看视频并查看https://cdn.dorms.com/static/js/social.js中的代码,显然还有更多内容,而不仅仅是您在此处提供的代码。
Suggestions for the person with the device 有关设备的人的建议
http://
or https://
and/or make the timeout longer. http://
或https://
和/或使用更长的超时来设置弹出URL。 I doubt very much this will help but there may be some weirdness going on. † My page contains the following HTML: †我的页面包含以下HTML:
<!DOCTYPE html>
<html>
<head>
<title>Test web page</title>
<script>
var google_login_popup = "";
var social_google_login = function () {
google_login_popup = window.open('www.google.com', "google_popup", 'width=800, height=600');
};
social_google_login();
setTimeout(function() {
google_login_popup.close();
}, 1000);
</script>
</head>
<body>Test web page</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.