Edit in JSFiddle

var twitterFavicon = document.createElement('img');
twitterFavicon.src = '//twitter.com/login?redirect_after_login=%2Ffavicon.ico';
twitterFavicon.addEventListener('load', function () {
    document.getElementById('status').innerHTML = 'Logged into Twitter: Yes';
});
twitterFavicon.addEventListener('error', function () {
    document.getElementById('status').innerHTML = 'Logged into Twitter: No';
});
<p id="status"></p>