Question

I'm following what is shown on the Google+ API documentation. For some reason, my button isn't clickable at all. Nothing shows up. Nothing happens. I'm running this from the url: file:///TestPage.html in Google Chrome.

<html>
    <head>
        <title>Test Page</title>
        <script type="text/javascript">
            function onSuccess() {
                //called fine.
            }

            (function() {
                var po = document.createElement('script');
                po.type = 'text/javascript';
                po.async = true;
                po.src = 'https://apis.google.com/js/client:plusone.js?onload=onSuccess';
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(po, s);
            })();

            function onSignInCallback(res) {
                alert('callback'); //doesn't show up.
            }
        </script>
    </head>

    <!-- Not clickable -->
    <button id='signInBtn' class="g-signin"
        data-scope="https://www.googleapis.com/auth/plus.login"
        data-clientid="1085488274737.apps.googleusercontent.com"
        data-callback="onSignInCallback"
        data-theme="dark"
        data-approval-prompt="force"
        data-cookiepolicy="single_host_origin"
        data-requestvisibleactions="http://schemas.google.com/AddActivity"
        data-width="wide">
    </button>
</html>

Any ideas why nothing happens? Why is my button not even clickable?

Était-ce utile?

La solution

As akonsu said, see the console of browser

enter image description here

Please access the page from a local web server, not a simple way like file:// URL.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top