弹出窗口阻止铬的GDrive的授权 [英] Popup blocking the gdrive authorization in chrome
问题描述
所以,问题是,弹出窗口阻止窗口,即使它是由用户操作完成打开,单击例如..
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)
})
它工作正常,但如果我这样做是抛出GDrive的API(gapi.auth.authorize),这种阻塞无妨。
it works fine, but if i did it throw the gdrive api(gapi.auth.authorize), this blocking anyway.
有一个必须,我不能强迫用户关闭popap阻塞。
我希望有人现在如何解决它:),谢谢
A must, I can not force users to off popap blocking. I hope that anybody now how solved it :), thanks
推荐答案
只需添加一个参考
的https://developers.google.com/api-client-library/javascript/reference/referencedocs
gapi.auth.init(回调)
初始化授权功能。调用此当从gapi.auth.authorize呼叫阻塞AUTH窗口中的客户端负载为prevent弹出窗口拦截器。
gapi.auth.init(callback) Initializes the authorization feature. Call this when the client loads to prevent popup blockers from blocking the auth window on gapi.auth.authorize calls.
PS:投票最多需要15个声誉..所以不能投票了Ben的回答是:)
ps: vote up requires 15 reputation .. so couldn't vote up Ben's answer :)
这篇关于弹出窗口阻止铬的GDrive的授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!