<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 17, 2009, at 2:09 PM, Darin Fisher wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div class="gmail_quote">On Thu, Sep 17, 2009 at 12:52 PM, Maciej Stachowiak <span dir="ltr">&lt;<a href="mailto:mjs@apple.com">mjs@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <div style="word-wrap:break-word"><br><div><div class="im"><div>On Sep 17, 2009, at 12:14 PM, Darin Fisher wrote:</div><br><blockquote type="cite"><br><br><div class="gmail_quote">On Thu, Sep 17, 2009 at 2:28 AM, Maciej Stachowiak <span dir="ltr">&lt;<a href="mailto:mjs@apple.com" target="_blank">mjs@apple.com</a>&gt;</span> wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div><br> On Sep 17, 2009, at 12:35 AM, Darin Fisher wrote:<br> <br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br> <br> For &lt;a ping&gt; to be used as I suggested, you would need to set the href to a javascript URL such as javascript:void(), so that it would not interfere with an existing navigation.<br> </blockquote> <br></div> Navigating to a javascript: URL will still cancel with an existing pending navigation, both per spec and in at least some browser engines (including WebKit). For spec reference see step 5 here: &lt;<a href="http://dev.w3.org/html5/spec/Overview.html#navigate" target="_blank">http://dev.w3.org/html5/spec/Overview.html#navigate</a>&gt;. Note lack of exception for "javascript:" URLs.</blockquote> <div><br></div><div>nit: WebKit and most browsers that I tested _only_ do so if the javascript: URL evaluates to a string. Take a look at FrameLoader::executeIfJavaScriptURL(). &nbsp;I can also share my test case with you if you are still doubting! ;-)</div> </div></blockquote><div><br></div></div><div>My test case did this from an onclick handler, and the navigation to <a href="http://yahoo.com" target="_blank">yahoo.com</a> did not happen:</div><div><br></div><div><div>&nbsp;&nbsp; &nbsp; location.href="<a href="http://yahoo.com/" target="_blank">http://yahoo.com/</a>";</div> <div>&nbsp;&nbsp; &nbsp; location.href="javascript:void()";</div><div><br></div></div></div></div></blockquote><div><br></div><div>Yes, in that case the scheduled location change from the first href assignment is cancelled by the second.</div> <div><br></div><div>My test case was to dispatch a click event to an anchor tag during the unload handler. &nbsp;Set the anchor's href to javascript:void() and notice that it does not interrupt the existing navigation.</div></div></blockquote><div><br></div><div>Navigation from unload handlers is buggy.</div><br><blockquote type="cite"><div class="gmail_quote"> <div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div><div><div></div><div>It may be that other ways of navigating to a javascript: URL don't stop a pending load, but that would be a bug.</div> </div></div></div></blockquote><div><br></div><div>I'm not sure. &nbsp;It seems like each browser goes out of its way to only cancel the existing navigation when the javascript: URL results in a string. &nbsp;Coincidence, really??</div></div></blockquote><div><br></div><div>It seems like a bug that it's inconsistent between different ways of navigating.</div><br><blockquote type="cite"><div class="gmail_quote"> <div>&nbsp;</div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div style="word-wrap:break-word"><div><div><div><br></div><div>Based on your comments below, I think the expedient thing to do is to let Image loads (only) complete their I/O when initiated from unload or pagehide.</div> </div></div></div></blockquote><div><br></div><div>Why exclude beforeunload? &nbsp;Some of the sites we found use the busy loop hack in beforeunload.</div></div></blockquote></div><br><div>I wasn't deliberately excluding it. Including beforeunload seems fine.</div><div><br></div><div>Regards,</div><div>Maciej</div><div><br></div></body></html>