I have a Chrome extension should allow the users to log in with Google via a popup because it won't display in the iframe. I was doing this with window.open()
which worked fine except that I could not close the pop-up after the user logged in.
I have been trying with no success to use chrome.windows.create
instead of window.open
in hopes that I will be able to close the popup once I detect via the URL that they have successfully logged in.
In popup_google.js
I have simple function:
function login(login_url) {
// var win = window.open(login_url, "windowname1", 'width=800, height=600');
chrome.windows.create({'url': 'http://stackoverflow.com/', 'type': 'popup'}, function(window) { });
}
The login function is called via "onclick"
something like this:
<a href='#' onClick='login("https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http%3A%2F%2Fdev.sbceoportal.org%2Fcastest%2Fwp-login.php&client_id=191567976061-9uksb59gedrtlsmoeo1fouov94370j96.apps.googleusercontent.com&scope=openid+email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&access_type=online&approval_prompt=auto&state=d96bdddc11%257Chttp%253A%252F%252Fdev.sbceoportal.org%252Fcastest%252Fportal%252F");' id="loginText"> Click here to login </a>
I can't for the life of me get the chrome.windows.create
to open a new popup window, even in the simplest form you see here, but window.open
works like a charm (I just can't seem to get it closed in Chrome).
` tag.
– wOxxOm Oct 27 '15 at 17:08