检测当前是否有网络用户登录Google? [英] Detect if a web user is currently logged in Google?

查看:123
本文介绍了检测当前是否有网络用户登录Google?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设仅当我知道访问我的网站的用户具有有效的Google帐户并且该帐户已登录该帐户时,我才想显示某些内容.

Suppose I want to display certain content only if I know the user coming to my website has a valid Google Account and it's logged into that account.

有没有办法用Javascript做到这一点?我知道Facebook API提供了告知用户状态(登录Facebook)的方法,并且我确定我也看到过使用Google帐户执行此操作的网站,但是在Google中搜索相关术语会使我无处可去因为搜索字词的针对性很差.

Is there any way to do this in Javascript? I know that the Facebook API provides ways to tell the status of a user (logged in Facebook) and I'm sure I've seen sites doing this with Google Accounts as well, but searching for the relevant terms in Google leads me to nowhere as the search terms are poorly focused.

谢谢您的帮助.

推荐答案

此博客声称已通过检查与G +/twitter/etc提供的社交平台相关的图像返回值来做到这一点

This blog claims to have done it, via checking for image return values linked to the social platforms provided by G+ / twitter / etc

http://www.tomanthony.co.uk/blog /detect-visitor-social-networks/

<img style="display:none;"
onload="show_login_status('Google', true)"
onerror="show_login_status('Google', false)"
src="https://accounts.google.com/CheckCookie?continue=https%3A%2F%2Fwww.google.com%2Fintl%2Fen%2Fimages%2Flogos%2Faccounts_logo.png&followup=https%3A%2F%2Fwww.google.com%2Fintl%2Fen%2Fimages%2Flogos%2Faccounts_logo.png&chtml=LoginDoneHtml&checkedDomains=youtube&checkConnection=youtube%3A291%3A1"
/>

这篇关于检测当前是否有网络用户登录Google?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆