Google plus 如何阻止谷歌+;从弹出消息“登录”按钮;欢迎回来,你';我已经通过谷歌+;以…“身份登录”;

Google plus 如何阻止谷歌+;从弹出消息“登录”按钮;欢迎回来,你';我已经通过谷歌+;以…“身份登录”;,google-plus,google-oauth,Google Plus,Google Oauth,我正在使用将Google+登录按钮添加到我的站点。 以下是如何呈现“登录”按钮: <script type="text/javascript"> (function () { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://plus.google.c

我正在使用将Google+登录按钮添加到我的站点。 以下是如何呈现“登录”按钮:

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

<script type="text/javascript">
    function renderGPlus() {
        gapi.signin.render('customGPlusBtn', {
            'callback': 'gPlusSignInCallback',
            'clientid': '<my_client_id>',
            'redirecturi': 'postmessage',
            'accesstype': 'offline',
            'cookiepolicy': 'single_host_origin',
            'requestvisibleactions': 'http://schemas.google.com/BuyActivity',
            'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email'
        });
    }
</script>

(功能(){
var po=document.createElement('script');
po.type='text/javascript';
po.async=true;
po.src=https://plus.google.com/js/client:plusone.js?onload=renderGPlus';
var s=document.getElementsByTagName('script')[0];
s、 parentNode.insertBefore(po,s);
})();
函数renderGPlus(){
gapi.signin.render('customGPlusBtn'{
“回调”:“gPlusSignInCallback”,
“客户ID”:“,
“重定向URI”:“postmessage”,
'accesstype':'offline',
'cookiepolicy':'single_host_origin',
“请求访问操作”:http://schemas.google.com/BuyActivity',
'范围':'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email'
});
}
加载按钮后,它会立即检查用户是否已授权我的应用程序(即时模式)。如果用户以前授权过我的应用程序,则会在页面底部弹出一个通知栏,并显示消息“欢迎回来,您已经通过Google+以…身份登录连接了此应用程序”


是否有任何方法可以阻止此消息弹出?

首先,此消息仅在用户第一次登录时显示,并被Google识别为特定浏览器会话。换句话说,用户只有在关闭浏览器窗口并启动新的浏览器会话后才能看到消息

当您看到授权结果成功地将用户返回并更新为授权状态时,应随时授权用户。因此,每当出现此消息时,用户都会自动登录

因为出现的消息是为了通知用户他们已自动登录,所以您可能不应该禁止此消息,除非您是有意为您显式管理其会话的用户执行此操作

但是,如果您已经实现了显式注销,并且正在管理用户的登录状态,那么对plusone.js synchronous include的以下代码更改将抑制toast消息

<script src="https://apis.google.com/js/plusone.js">
  isSignedOut: true
</script>
更新:

正如该解决方案所指出的,在铬中不起作用。您可以添加以下CSS以隐藏生成的iframe:

iframe[src^="https://apis.google.com"] {
  display: none;
}

由于他的答案比我的要完整得多,并且解决了其他问题,请查看。

接受的答案是正确的方法,但是如果出于其他原因,您只想隐藏生成的iframe,您可以使用CSS:

iframe[src^="https://apis.google.com"] {
  display: none;
}

就在最近,这个页面上最新接受的答案是隐藏“谷歌登录欢迎回来弹出窗口”

再也不行了

目标:在所有浏览器上“隐藏或抑制Google+登录欢迎回复消息”

如果您一直在使用`

window.___gcfg = { isSignedOut: true };
取消显示警告。经过认真的实验,我发现了这一点

我建议您使用此iframe版本来抑制网页上任何类型的Google API弹出窗口

Iframe 1:
Iframe[src^=”https://apis.google.com“]{display:none;}
这将隐藏网页上Google API的所有弹出窗口

Iframe 2:
Iframe[src^=”https://apis.google.com/u/0/_/sharebox“]{display:none;}
这将隐藏您网页上所有的谷歌交互式共享对话框弹出窗口

Iframe 3:
Iframe[src^=”https://apis.google.com/u/0/_/widget/oauthflow/toast“]{display:none;}
这将隐藏网页上所有的“谷歌欢迎回复信息””弹出窗口

Iframe 4:
Iframe[src^=”https://apis.google.com/u/0/_/+1/“]{display:none;}
这将隐藏您网页上的所有“谷歌+1按钮”

因此,对于这个特定的问题,请在HTML页面的Head标记中执行此操作

 <style> `iframe[src^="https://apis.google.com/u/0/_/widget/oauthflow/toast` </style>
`iframe[src^='https://apis.google.com/u/0/_/widget/oauthflow/toast` 
您已经对其进行了测试,并且运行良好。

的最后一个样式代码必须是:

<style>
iframe[src^="https://apis.google.com/u/0/_/widget/oauthflow/toast"] {
  display: none;
}
</style>

iframe[src^=”https://apis.google.com/u/0/_/widget/oauthflow/toast"] {
显示:无;
}
而且运行良好

编辑:

下面的编码也隐藏了登录按钮

<style>
iframe[src^="https://apis.google.com"] {
    display: none;
}
</style>

iframe[src^=”https://apis.google.com"] {
显示:无;
}

Thank@class。是的,我正在管理用户的登录状态。如果用户在从我的应用程序注销后看到弹出消息,这会让他们感到困惑。顺便问一下,我从哪里可以获得有关全局配置标志的更多信息?它是否在任何地方被记录?Google+文档的开发人员文档e支持的标志。您可以在此处找到一个示例:。如果您正在查找汇总所有标志的文档功能,请向Google+问题跟踪器添加一个功能请求:再次感谢。我添加了一个功能请求:我遵循了
display:none
建议。这导致了一个主要问题,即Google+共享此时对话框不可见。@Chimdi2000的答案有更具体的选择器可供使用。
<style>
iframe[src^="https://apis.google.com/u/0/_/widget/oauthflow/toast"] {
  display: none;
}
</style>
<style>
iframe[src^="https://apis.google.com"] {
    display: none;
}
</style>