[html5] OnStorage Event

Ian Hickson ian at hixie.ch
Wed May 5 19:00:33 PDT 2010


On Wed, 5 May 2010, Jaikishan Jalan wrote:
> 
> I understand that onstorage event will be invoked if setItem, removeItem 
> or clear is invoked on either sessionStorage object or localStorage 
> object. I am curious how can I determine which object has changed from 
> within the onstorage event handler. To be precise, is the function 
> called because localStorage object changed or sessionStorage object 
> changed. storageArea attribute to event object does not help.

You should be able to compare the storageArea attribute of the event 
against the localStorage and sessionStorage objects.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the Help mailing list