<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Thank you very much for your thoughts, Dmitry!</div><div><br></div><div>I'm sure one can use the iframe approach you mention. Would you agree, though, that this is not a very elegant way of solving this problem?</div><div><br></div><div>I also completely agree that a timeout would be a bad idea here (unreliable in so many ways it gives me hives)</div><div><br></div><div>However, I feel like I don't understand your point about redirects being difficult/unreliable. Sounds like there's something I don't understand. Can you explain more?</div><div><br></div><div>Thanks!</div><div><br></div><div>David</div><div><br></div><div><div><br><div><div>On 2010/6/4, at 上午9:25, Dmitry Titov wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote"><div>Hi David,</div><div><br></div><div>Yes, the shared worker will not survive this transition. One way to keep it alive is to use more complex page with nested iframe (and navigate the iframe, keeping parent alive).</div>
<div><br></div><div>Theoretically, the spec could prescribe keeping the worker alive for a certain period of time, or when navigating to another page in the same origin, but all those methods are somewhat unreliable (timeouts are arbitrary, redirects are difficult etc).</div>
<div><br></div><div>Dmitry</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">David John Burrowes</b> <span dir="ltr"><<a href="mailto:davidjohnburrowes@gmail.com" target="_blank">davidjohnburrowes@gmail.com</a>></span><br>
Date: Thu, May 27, 2010 at 5:53 PM<br>Subject: [html5] Newbie question about SharedWorkers<br>To: <a href="mailto:help@lists.whatwg.org" target="_blank">help@lists.whatwg.org</a><br><br><br>Hello all,<br>
<br>
I'm making my way through the spec about Workers, and have a question about SharedWorkers.<br>
<br>
<br>
The spec makes various references to shared workers being used by multiple pages in parallel. My question is can a shared worker be used by two sequentially accessed pages? My reading of the spec says "no", but my intuition about what behavior I would "expect" says I should be able to. Is my reading of the spec right?<br>
<br>
Here's an example:<br>
We have two pages: P1 and P2 (from the same origin etc)<br>
P1 has a link to P2 on it (<a href="P2">)<br>
<br>
Both P1 and P2 reference a shared worker SW<br>
<br>
When the user gets page P1, then SW is created.<br>
User then clicks on the link to P2<br>
<br>
My interpretation of the spec says that when this link is clicked, P1 will be made no longer active, so it will be removed from SW's list of Documents. This will leave SW's list empty, which will make it no longer a permissable worker. It's closing flag will be set to true, and presumably there's a chance it will be destroyed before P2 can be loaded and access SW. So, P2 will need to re-create SW.<br>
<br>
It seems desirable to me that if a page transition is being made between pages with compatible origins, that a shared worker would be preserved across them, allowing complex calculations being done by the worker to be shared by the pages (obviously, the worker could be storing its work in a database, and then reloading that when it is created. But, that seems like overkill)<br>
<br>
Thoughts?<br>
<br>
David<br>
<br>
_______________________________________________<br>
Help mailing list<br>
<a href="mailto:Help@lists.whatwg.org" target="_blank">Help@lists.whatwg.org</a><br>
<a href="http://lists.whatwg.org/listinfo.cgi/help-whatwg.org" target="_blank">http://lists.whatwg.org/listinfo.cgi/help-whatwg.org</a><br>
</div><br>
</blockquote></div><br>
</blockquote></div><br></div></div></body></html>