As mentioned in the Google+ api documentation I am trying to asynchronusly load Javascript API for Google login with the following code in the <head
> section
<script> window.___gcfg = { lang: "en-US", parsetags: "onload" } </script> <script src="https://apis.google.com/js/client:platform.js?onload=activate_google" async defer></script>
The call back API shows a button that is hidden until the api loads. But even after the callback fires the the api keeps loading. If I press the Login button before the loading finishes the google login window is briefly shown and then it closes again.
I need to know how I can wait for the API to load completely and executed before showing the custom login button. I would like to avoid polling.
According to: https://developers.google.com/api-client-library/javascript/features/cors#Loadingthestandaloneauthclient
You can call:
gapi.load('auth', function() { // at this point gapi.auth is ready. });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.