[whatwg] SQL storage and onunload

Alexey Proskuryakov ap at webkit.org
Sun Feb 10 12:21:07 PST 2008


On Feb 10, 2008, at 3:17 PM, Anne van Kesteren wrote:

> On Sat, 09 Feb 2008 22:06:39 +0100, Alexey Proskuryakov  
> <ap at webkit.org> wrote:
>> On Feb 9, 2008, at 12:58 PM, Anne van Kesteren wrote:
>>>> As far as the unload handler question, what are the semantics for  
>>>> XHR?
>>>
>>> I think the user leaving the page is the same as aborting the  
>>> download.
>>
>>   I've seen servers (e.g. Google) use XHR in onunload to track  
>> usage statistics. Sounds like a reasonable use case (really, is  
>> there a better way?).
>
> How do you determine when you can end the process? It also seems  
> kind of icky that the window is already closed (as far as the end  
> user is concerned), but that code is still executing on behalf of it.


   I don't know - this doesn't currently work in WebKit. But it  
presumably works in other engines, given that there is code that uses  
it.

   I don't think it's particularly evil to make a single XHR request  
from onunload, with an understanding that no response will be  
delivered. However for SQL storage, one cannot just execute a  
statement without asynchronously creating a transaction, which makes  
it even more tricky.

- WBR, Alexey Proskuryakov





More information about the whatwg mailing list