Skip to content

Instantly share code, notes, and snippets.

@marcojetson
Last active August 29, 2015 13:56
Show Gist options
  • Save marcojetson/8806021 to your computer and use it in GitHub Desktop.
Save marcojetson/8806021 to your computer and use it in GitHub Desktop.
Detect if visitor is logged into Google, Google Plus, Taringa! or Twitter
// check<Service>Status([ onSuccess, onFailure ]);
// i.e checkTaringaStatus(function () { alert('+10'); });
(function () {
var checkServiceStatus = function (image, success, error) {
return function (success, error) {
var img = new Image();
img.onload = success || function () {};
img.onerror = error || function () {};
img.src = image;
};
};
window.checkGoogleStatus = checkServiceStatus("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");
window.checkGooglePlusStatus = checkServiceStatus("https://plus.google.com/up/?continue=https://www.google.com/intl/en/images/logos/accounts_logo.png&type=st&gpsrc=ogpy0");
window.checkTaringaStatus = checkServiceStatus("https://www.taringa.net/login?redirect=/img/logo.png");
window.checkTwitterStatus = checkServiceStatus("https://twitter.com/login?redirect_after_login=%2Fimages%2Fspinner.gif");
}());
@fulldecent
Copy link

Validation error: update & to &amp;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment