18910140161

JavaScript-使用Google按钮更改登录标签-堆栈溢出

顺晟科技

2022-10-18 12:21:57

201

我做了一个";登录谷歌";按钮,但我只想将其文本更改为“注册谷歌”。没有别的,但我想改变标签,任何帮助,请!下面是我的代码:

<代码><;!文档类型HTML>;<;HTML(>;)<;头部>;<;meta name=";Google-signin-client_ID";内容=";XXXXX.apps.googleusercontent.com";>;<;/标题>;<;身体>;<;DIV ID=";我签名2";>;<;/DIV>;<;脚本>;函数OnSuccess(GoogleUser){var auth2=gapi.auth2.getAuthInstance();auth2.signout();}//GoogleSignIn结束函数OnFailure(错误){console.log(错误);}//自定义Google按钮函数renderButton(){gapi.signin2.render(' my-signin2 ',{' scope ':'档案电子邮件','宽度':245,“身高”:40,' longtitle ':true,'主题':'黑暗',' onSuccess ':onSuccess,“ OnFailure ”:OnFailure});}<;/脚本>;<;脚本SRC=";https://apis.google.com/js/platform.js?onload=renderButton";异步延迟>;<;/脚本>;<;/正文>;<;/HTML>;

顺晟科技:

在HTML中呈现新的“使用Google登录”按钮

可能很简单。数据文本属性。正在设置<!doctype html> <html> <head> <meta name="google-signin-client_id" content="xxxxx .apps.googleusercontent.com"> </head> <body> <div id="my-signin2"></div> <script> function onSuccess(googleUser) { var auth2 = gapi.auth2.getAuthInstance(); auth2.signOut(); }//end of googleSignIn function onFailure(error) { console.log(error); } //custom google button function renderButton() { gapi.signin2.render('my-signin2', { 'scope': 'profile email', 'width': 245, 'height': 40, '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> 将呈现一个名为“注册Google ”的按钮就像你要求的.

与代码片段中显示

的旧库一样,新按钮支持JavaScript回调处理程序或后端服务器重定向,后者在用户登录后共享ID令牌凭据。

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航