Reputation: 12488
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. But .close() doesn't close the window.
This should work as the script opening the window is also trying to close it.
Note that this only applies for Firefox 47, mobile.
Video: https://www.dropbox.com/s/bqcf8iwm5bsw4yn/VIDEO0254.mp4?dl=0.
Upvotes: 7
Views: 293
Reputation: 1064
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. 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.
Suggestions for the person with the device
http://
or https://
and/or make the timeout longer. I doubt very much this will help but there may be some weirdness going on.† My page contains the following 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>
Upvotes: 1