質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top