View Full Version : Gmails Autosave Feature

02-17-2007, 12:16 AM
I was playing around with the compose feature of gmail today and I noticed that it seemed to have an extremely intelligent auto-save feature. What intrigued me about it was that it only seemed to auto-save the document when you were not working on it and when there was actually something that needed to be done.

However the most interesting (i.e., bit that stumped me) was how while in the middle of auto-uploading a large attached file I am able to edit the e-mail and yet when it has finished uploading the attachment (and the page seemingly refreshes) the changes I made to the e-mail are still there.

Could anyone be so kind as to enlighten me as to just how exactly the auto-save feature works (as I am interested implementing something similar for my own site), especially in the region of attachment handling.

I know that they must have some kind of JavaScript on-key-press callback that detects when you are working on a document but that is about all I can extrapolate.

Regards, Freddie.

02-17-2007, 02:04 PM
I have been looking into this some more today and although I have come up with some potential ways that they could have done it none of them appear to be the way they actually have:

First up was to use an iframe, however I scanned the DOM tree and found no sign of an iframe and also noticed that when the file uploaded the entire page appeared to refresh.

That leads me to believe that they are using another method: but how does one allow for a form to be edited while it is being submitted, unless that is a way has been devised to ensure that the browser uploads the files first and then the text body. However I will need to look into the feasibility of this method some more before I can tell if it is the actual method used by gmail.