views:

144

answers:

3

I want to know whether or not I have a new email from Gmail, but I don't want to go to Gmail all the time.

Is it possible to use javascript to check if a new message has arrived? I know it is possible using php classes, but I would like to do it javascript also.

A: 

Nah, don't think so. Keeping in mind that the only way to do something like that would be AJAX-related => no possibility to access other sites but same as the JS on which the page resides on.

Jefim
+2  A: 

I guess the first assumption should be the Gmail user should have got logged in to Gmail Website in the same browser and without any restarts of the machine, in other words gmail cookie should be alive and should say gmail that who is the logged in user.

Then you may write javascript to load http://mail.google.com in some hidden iframe and take it's document handle to explore the DOM of that page and find out any bold row in inbox table (this is very simple in saying but definately be complex in doing)

jatanp
sounds interesting. is it possible to explore the DOM of a page that is inside an iframe with javascript? is there no browser cross-domain issues? i haven't done something like this before.
chris
I don't think so. For iframe there are no cross-domain issues. I am telling this because somewhere I have found and manipulate the code which would automatically extract contacts from your Orkut profile and send some specially crafted scrap to them (like spam). I knew because I was too one of the victim of that spam :).
jatanp
A: 

Yes and No. You can't do it with Javascript alone, but you can do it with Javascript if you can write some sort of proxy script to log into gmail and check for you - and then return that data in text/json/php/whatever...

michael