<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: WebKit Page Cache II &#8211; The unload Event</title>
	<atom:link href="http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/</link>
	<description>All about WebKit development</description>
	<lastBuildDate>Thu, 09 Feb 2012 11:34:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: randallfarmer</title>
		<link>http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/comment-page-1/#comment-25215</link>
		<dc:creator>randallfarmer</dc:creator>
		<pubDate>Fri, 25 Sep 2009 21:31:09 +0000</pubDate>
		<guid isPermaLink="false">http://webkit.org/blog/?p=516#comment-25215</guid>
		<description>@Brady:

In my defense, the pages I&#039;m thinking of are essentially one big form, and if you leave the page, you&#039;re usually either submitting or never coming back (e.g., closing the window).  The onunload is there full-time for these pages right now (I might fix!), but navigating away without submitting and then coming back is rare enough that slowing down that case is bearable, if sloppy.

Thanks much for considering history.navigationMode and for wading through my longwinded comment.  I think you distilled it right: some folks could use an &quot;explicit, semantically precise&quot; way to tell the browser they&#039;ve destroyed the DOM.  

You&#039;re also right that we&#039;ll inevitably sometimes use it in ways that make the page slower than is strictly necessary -- sorry.  Browser developers put up with a lot of nonsense from Web developers -- we owe you one.  Or rather, we owe you many many. :)</description>
		<content:encoded><![CDATA[<p>@Brady:</p>
<p>In my defense, the pages I&#8217;m thinking of are essentially one big form, and if you leave the page, you&#8217;re usually either submitting or never coming back (e.g., closing the window).  The onunload is there full-time for these pages right now (I might fix!), but navigating away without submitting and then coming back is rare enough that slowing down that case is bearable, if sloppy.</p>
<p>Thanks much for considering history.navigationMode and for wading through my longwinded comment.  I think you distilled it right: some folks could use an &#8220;explicit, semantically precise&#8221; way to tell the browser they&#8217;ve destroyed the DOM.  </p>
<p>You&#8217;re also right that we&#8217;ll inevitably sometimes use it in ways that make the page slower than is strictly necessary &#8212; sorry.  Browser developers put up with a lot of nonsense from Web developers &#8212; we owe you one.  Or rather, we owe you many many. <img src='http://www.webkit.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brady Eidson</title>
		<link>http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/comment-page-1/#comment-25214</link>
		<dc:creator>Brady Eidson</dc:creator>
		<pubDate>Fri, 25 Sep 2009 16:02:32 +0000</pubDate>
		<guid isPermaLink="false">http://webkit.org/blog/?p=516#comment-25214</guid>
		<description>@randalfarmer
It would stink if you had to take some action to disable the page cache full-time when you only really want it disabled in this one edge case.  As mentioned in the post, developers should only install unload handlers when they actually need them to be installed.  Do you install an unload handler full-time, or do you install it only in onsubmit?

If there were some other programatic way to disable the PageCache, that would still be desirable to the unload handler.  Semantically, the &quot;unload handler&quot; and &quot;I want to disable the PageCache!&quot; are two completely different things.  

Opera invented &quot;history.navigationMode&quot; for this reason.  We might consider implementing that (https://webkit.org/b/29739) but I would shudder if developers just started flipping the switch at page load and left it on the whole time!

Of course, maybe that wouldn&#039;t be much different than the situation today...</description>
		<content:encoded><![CDATA[<p>@randalfarmer<br />
It would stink if you had to take some action to disable the page cache full-time when you only really want it disabled in this one edge case.  As mentioned in the post, developers should only install unload handlers when they actually need them to be installed.  Do you install an unload handler full-time, or do you install it only in onsubmit?</p>
<p>If there were some other programatic way to disable the PageCache, that would still be desirable to the unload handler.  Semantically, the &#8220;unload handler&#8221; and &#8220;I want to disable the PageCache!&#8221; are two completely different things.  </p>
<p>Opera invented &#8220;history.navigationMode&#8221; for this reason.  We might consider implementing that (<a href="https://webkit.org/b/29739" rel="nofollow">https://webkit.org/b/29739</a>) but I would shudder if developers just started flipping the switch at page load and left it on the whole time!</p>
<p>Of course, maybe that wouldn&#8217;t be much different than the situation today&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: randallfarmer</title>
		<link>http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/comment-page-1/#comment-25213</link>
		<dc:creator>randallfarmer</dc:creator>
		<pubDate>Fri, 25 Sep 2009 07:28:35 +0000</pubDate>
		<guid isPermaLink="false">http://webkit.org/blog/?p=516#comment-25213</guid>
		<description>As a user, I like more aggressive page caching.  One approach might be to look for a small class of onunload handlers that are generally safe to ignore, like Prototype&#039;s and empty handlers.

As a Web developer, I&#039;ve sometimes specifically wanted to turn off the back/forward cache.  For example, I sometimes have an onsubmit handler -- not an onunload! -- that leaves the page in an unusable state, e.g., by disabling the submit button.  (That means my form is broken if the user starts to submit then immediately hits Esc.)  

When the user hits Back, I&#039;d rather they see the page as it was at load time (but with form data filled in), not as it was after submit.  In an ideal world, I&#039;d want them to see the page as it was just before they hit Submit, but that&#039;s not feasible to do.

Right now, I avoid the page cache by adding an empty onunload handler to disable the page cache, but that will break.  As alternatives, I could add a cache-control header, or call window.location.reload() in onpageshow if evt.persisted.  Both approaches have the downside of forcing the page&#039;s HTML to be redownloaded as well as skipping the page cache.  What do you all think is the best thing to do if I want to opt out of the page cache but am OK with the browser using the cached HTML?

I know there are more elegant options than opting out of the page cache, like just not messing with the form in my onsubmit handler or &quot;fixing&quot; the form in onpageshow.  Still, it seems interesting to ponder what to do if you want to opt out of the page cache; surely someone out there will.</description>
		<content:encoded><![CDATA[<p>As a user, I like more aggressive page caching.  One approach might be to look for a small class of onunload handlers that are generally safe to ignore, like Prototype&#8217;s and empty handlers.</p>
<p>As a Web developer, I&#8217;ve sometimes specifically wanted to turn off the back/forward cache.  For example, I sometimes have an onsubmit handler &#8212; not an onunload! &#8212; that leaves the page in an unusable state, e.g., by disabling the submit button.  (That means my form is broken if the user starts to submit then immediately hits Esc.)  </p>
<p>When the user hits Back, I&#8217;d rather they see the page as it was at load time (but with form data filled in), not as it was after submit.  In an ideal world, I&#8217;d want them to see the page as it was just before they hit Submit, but that&#8217;s not feasible to do.</p>
<p>Right now, I avoid the page cache by adding an empty onunload handler to disable the page cache, but that will break.  As alternatives, I could add a cache-control header, or call window.location.reload() in onpageshow if evt.persisted.  Both approaches have the downside of forcing the page&#8217;s HTML to be redownloaded as well as skipping the page cache.  What do you all think is the best thing to do if I want to opt out of the page cache but am OK with the browser using the cached HTML?</p>
<p>I know there are more elegant options than opting out of the page cache, like just not messing with the form in my onsubmit handler or &#8220;fixing&#8221; the form in onpageshow.  Still, it seems interesting to ponder what to do if you want to opt out of the page cache; surely someone out there will.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yuan Song</title>
		<link>http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/comment-page-1/#comment-25212</link>
		<dc:creator>Yuan Song</dc:creator>
		<pubDate>Tue, 22 Sep 2009 17:11:55 +0000</pubDate>
		<guid isPermaLink="false">http://webkit.org/blog/?p=516#comment-25212</guid>
		<description>To fire the unload event  whenever the suspended page is eventually destroyed could be a good idea. I don&#039;t think executing scripts in an invisible page is a problem, since the ability of executing scripts in the background can bring other potential benefits in the future.</description>
		<content:encoded><![CDATA[<p>To fire the unload event  whenever the suspended page is eventually destroyed could be a good idea. I don&#8217;t think executing scripts in an invisible page is a problem, since the ability of executing scripts in the background can bring other potential benefits in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jake Archibald</title>
		<link>http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/comment-page-1/#comment-25211</link>
		<dc:creator>Jake Archibald</dc:creator>
		<pubDate>Tue, 22 Sep 2009 11:50:46 +0000</pubDate>
		<guid isPermaLink="false">http://webkit.org/blog/?p=516#comment-25211</guid>
		<description>BBC Glow has avoided adding an unload listener since 1.6 to avoid breaking this cache.

As for my thoughts on the issue, here&#039;s a partial reposting from https://bugs.webkit.org/show_bug.cgi?id=29021

You could save the page to the page cache, then fire the unload event and navigate away. If back is clicked, the page will be returned in the state it was BEFORE unload was fired. This gives you the best of both worlds. (this was suggested in Chrome&#039;s bug tracker)

Also, (and webkit may do this already) you need to make sure the element that the mouse is currently over has its mouseout event fired, else you might get sticky hover effects.

Jake.</description>
		<content:encoded><![CDATA[<p>BBC Glow has avoided adding an unload listener since 1.6 to avoid breaking this cache.</p>
<p>As for my thoughts on the issue, here&#8217;s a partial reposting from <a href="https://bugs.webkit.org/show_bug.cgi?id=29021" rel="nofollow">https://bugs.webkit.org/show_bug.cgi?id=29021</a></p>
<p>You could save the page to the page cache, then fire the unload event and navigate away. If back is clicked, the page will be returned in the state it was BEFORE unload was fired. This gives you the best of both worlds. (this was suggested in Chrome&#8217;s bug tracker)</p>
<p>Also, (and webkit may do this already) you need to make sure the element that the mouse is currently over has its mouseout event fired, else you might get sticky hover effects.</p>
<p>Jake.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: doekman</title>
		<link>http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/comment-page-1/#comment-25210</link>
		<dc:creator>doekman</dc:creator>
		<pubDate>Tue, 22 Sep 2009 09:22:26 +0000</pubDate>
		<guid isPermaLink="false">http://webkit.org/blog/?p=516#comment-25210</guid>
		<description>I would call it the &quot;Page Flip Cache&quot;...</description>
		<content:encoded><![CDATA[<p>I would call it the &#8220;Page Flip Cache&#8221;&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

