views:

54

answers:

1

How in javascript would get the number of unread emails for the currently signed in gmail account?

Related question - does Google offer any documentation on this sort of stuff?

+2  A: 

Here's the docs's you are looking for:

http://code.google.com/apis/gmail/docs/

Note, that there's no way to 'steal' the unread count from someones account using somme simple javascript without authentication.

tovare
Nice! Thanks. Now I just need the javascript way to check the unread count of the https://mail.google.com/mail/feed/atom.
Travis
You can make HTTP requests in JavaScript using XMLHttpRequest. http://www.jibbering.com/2002/4/httprequest.html If you have any further questions about that, start a new question.
Jason Hall
@Jason, you won't be able to use XHR to access https://mail.google.com/mail/feed/atom cross-domain. You need a JSONP API or some server side proxy.
Matthew Flaschen
I figured this would be a simple question. Maybe Javascript is not the way to go? How do all these extensions and plugins, etc. get your gmail unread count?
Travis
@Matthew, it seems some people has had success in the past with cross-domain GET requests, but not POST. http://www.aswinanand.com/2009/01/http-basic-authentication-using-ajax/
tovare
@Matthew is correct, you won't be able to make a direct XHR request for this. It should still be possible, it just won't be as direct as making a straight XHR request.
Jason Hall