Today I was accessing my corporate mail account in my home through dialup. I was replying to one of the mails from my Project Manager. After writing few paragraphs about my current work, I pressed send button. Then only I noticed my dialup connection was terminated, all my mail contents were lost. I told myself that I should have saved this mail somewhere. I reconnected to net and I was ready to type the mail again. But after I opened the mailbox compose screen, I got a popup..
WARNING: The following email was interrupted and was never sent
From : saravana@abc.com
To: Mymanager@abc.com
Do you wish to restore it?
Yes or No
I thought for while “this software understands my feelings”… I pressed yes.. please restore it… It restored that mail completely.. I was amazed with this feature at that time.. It saved me lots of time …
Then I was curious to know how they have implemented this feature. I did viewsource and got the code. Using javascript “SetInterval” function they executed a client side function continuously after certain interval. In that function, they saved the content of the mail to cookie (if cookie is disabled, they stored the data in side frame). When compose mail page is opened, they will check whether any data is there in cookie. If data is there, they will show a confirmation message for restoring that data. Though it looks simple, they have written around 50 lines of code for implementing this feature.
I faced this problem few times with .Text also, but I couldn’t restore the blog content back. Nowadays I used to write my blog in notepad or in my mailbox before I post it. It would be great if .Text supports this feature also…