0
我有一个非常基本的问题。我想谷歌的标志,从这个链接整合到我的网站: https://developers.google.com/identity/sign-in/web/sign-in谷歌登录按钮不起作用
所以我刚刚成立了一个新的HTML文件,用的正是这种代码
<!doctype html>
<html>
<head>
<meta name="google-signin-client_id" content="917979196053-718dnj8g6c71jkcim2pvqo17mo0b1819.apps.googleusercontent.com">
</head>
<body>
<div id="my-signin2"></div>
<script>
function onSuccess(googleUser) {
console.log('Logged in as: ' + googleUser.getBasicProfile().getName());
}
function onFailure(error) {
console.log(error);
}
function renderButton() {
gapi.signin2.render('my-signin2', {
'scope': 'profile email',
'width': 240,
'height': 50,
'longtitle': true,
'theme': 'dark',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}
</script>
<script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>
</body>
</html>
的代码是从这里: https://developers.google.com/identity/sign-in/web/build-button
现在的问题是,它根本无法正常工作。什么都没有显示在屏幕上,我不知道为什么。另一方面,当我在这里尝试它https://jsfiddle.net/wbzax22e/它以某种方式工作。
这真的很荒唐。有人可以帮我在这里吗?
谢谢!
这是在您的本地机器上吗?或者在一个网站? – HoogleyBoogley