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