谷歌浏览器扩展程序:如何找出用户是否登录Chrome浏览器? [英] Google Chrome extension: How to find out if a user has signed in to the Chrome browser?
问题描述
作为我构建的Google Chrome扩展程序的一部分,我需要能够判断用户是否在启用扩展程序的情况下登录Google Chrome浏览器。
请问如何使用OAuth2(以及 chrome.identity
API )超出了我的范围项目,所以我需要找到另一种方式。
编辑:我的问题不是重复的,因为该线程中的解决方案不再有效。
检查 LSID
cookie : p>
chrome.cookies.get({url:'https://accounts.google.com',name:'LSID'},函数(cookie){
if(cookie){
console.log('Sign-in cookie:',cookie);
}
});
manifest.json权限:cookies,https:// accounts .google.com /
As part of a Google Chrome extension that I'm building I need to be able to tell if a user has signed in to the Google Chrome browser while the extension is enabled.
How can I do this?
Please note that using OAuth2 (and thus, the chrome.identity
API) is beyond the scope of my project so I need to find another way.
EDIT: my question is not a duplicate of this one because the solution in that thread no longer works.
Check if LSID
cookie is set:
chrome.cookies.get({url:'https://accounts.google.com', name:'LSID'}, function(cookie) {
if (cookie) {
console.log('Sign-in cookie:', cookie);
}
});
manifest.json permissions: "cookies", "https://accounts.google.com/"
这篇关于谷歌浏览器扩展程序:如何找出用户是否登录Chrome浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!