Thanks Ian. Yes, it does work. I was checking it in wrong way in my event handler. The following works <div><br></div><div><div> function OnStorageHandler() { </div><div> if (event.storageArea == localStorage) {</div>
<div> alert("localstorage");</div><div> } else {</div><div> if (event.storageArea == sessionStorage) {</div><div> alert("sessionStorage");</div><div> }</div>
<div> } </div><div> }</div></div><br><div class="gmail_quote">On Wed, May 5, 2010 at 7:00 PM, Ian Hickson <span dir="ltr"><<a href="mailto:ian@hixie.ch">ian@hixie.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Wed, 5 May 2010, Jaikishan Jalan wrote:<br>
><br>
> I understand that onstorage event will be invoked if setItem, removeItem<br>
> or clear is invoked on either sessionStorage object or localStorage<br>
> object. I am curious how can I determine which object has changed from<br>
> within the onstorage event handler. To be precise, is the function<br>
> called because localStorage object changed or sessionStorage object<br>
> changed. storageArea attribute to event object does not help.<br>
<br>
</div></div>You should be able to compare the storageArea attribute of the event<br>
against the localStorage and sessionStorage objects.<br>
<font color="#888888"><br>
--<br>
Ian Hickson U+1047E )\._.,--....,'``. fL<br>
<a href="http://ln.hixie.ch/" target="_blank">http://ln.hixie.ch/</a> U+263A /, _.. \ _\ ;`._ ,.<br>
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Thanks,<br>Jaikishan<br>