javascript - How to open google login dialog in the same window instead of popup window? -
i have website users can login google account. using javascript google api.login method display google login dialog. default, triggers displaying new popup window
how open google login dialog displayed in same window user clicked on google login button?
code like-- <link href="https://fonts.googleapis.com/css?family=roboto" rel="stylesheet" type="text/css"> <script src="https://apis.google.com/js/client:platform.js?onload=render" async defer></script> <script type="text/javascript"> function render() { gapi.signin.render('custombtn', { 'callback': 'onsignincallback', 'clientid': 'my-client-id', 'cookiepolicy': 'single_host_origin', 'requestvisibleactions': 'http://schemas.google.com/addactivity', 'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email' }); } </script> <script type="text/javascript"> function onsignincallback(authresult) { if (authresult['access_token']) { // user signed in var loc = '/account/signinasgoogleuser?accesstoken=' + authresult['access_token']; window.location.href = loc; } else if (authresult['error']) { } } </script> <div class="align-center google_login_btn"> <div id="gsigninwrapper"> <div id="custombtn" class="customgplussignin"> <span class="icon"><i class="fa fa-google-plus"></i></span> <span class="buttontext">log in google</span> </div> </div> </div>
Comments
Post a Comment