So, the problem is that popup blocking the window open even if it is done by a user action, click for example..
gapi.auth.authorize({
client_id: this.client_id,
scope: this.scopes,
access_type: 'online',
immediate: immediate
}, function(authResult) {
console.log(authResult)
});
If i simply open the window on user click as here:
$('.some').click(funciton(){
window.open(someurl)
})
it works fine, but if i did it throw the gdrive api(gapi.auth.authorize), this blocking anyway.
A must, I can not force users to off popap blocking. I hope that anybody now how solved it :), thanks
Try this:
Include an onload event in your call to client.js
<script type="text/javascript" src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
Call gapi.auth.init from the onload function:
function handleClientLoad() { window.setTimeout(gapi.auth.init,1); }
In your authorize configuration set immediate: false.
Check that 1. is below 2. in the flow of the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With