<?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: Don&#8217;t Let the Door Hit You Onunload and Onbeforeunload</title>
	<atom:link href="http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 10:43:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Kevin</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-2453</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Fri, 19 Aug 2011 17:44:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-2453</guid>
		<description>I have found that the ajax code I have placed in onbeforeunload doesn&#039;t always fire (onbeforeunload is firing), so housekeeping doesn&#039;t always get done on the Server. Has anyone come across this? I assume the network connection may be lost, but since the page is closing, is there any way to access any ajax error information?</description>
		<content:encoded><![CDATA[<p>I have found that the ajax code I have placed in onbeforeunload doesn&#8217;t always fire (onbeforeunload is firing), so housekeeping doesn&#8217;t always get done on the Server. Has anyone come across this? I assume the network connection may be lost, but since the page is closing, is there any way to access any ajax error information?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pratap</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-1718</link>
		<dc:creator>pratap</dc:creator>
		<pubDate>Mon, 14 Dec 2009 12:47:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-1718</guid>
		<description>I found that onbeforeunload in safari is of no use if the window is opened in any of the frames of framesets in parent page. Safari never triggers the onbeforeunload event at all whereas it does triggers this event when not inside any frame.
Any idea?</description>
		<content:encoded><![CDATA[<p>I found that onbeforeunload in safari is of no use if the window is opened in any of the frames of framesets in parent page. Safari never triggers the onbeforeunload event at all whereas it does triggers this event when not inside any frame.<br />
Any idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Leatherman</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-1703</link>
		<dc:creator>Zach Leatherman</dc:creator>
		<pubDate>Sat, 31 Oct 2009 18:11:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-1703</guid>
		<description>Hey Ramesh,
What browsers are you seeing this behavior in?  I know the Safari Blog had some good blog posts about cached pages.
http://webkit.org/blog/427/webkit-page-cache-i-the-basics/

In any event, the onunload event should fire before a new page starts loading.  Double check the timing, there could be another issue causing the problems you&#039;re seeing.

Thanks,
Zach</description>
		<content:encoded><![CDATA[<p>Hey Ramesh,<br />
What browsers are you seeing this behavior in?  I know the Safari Blog had some good blog posts about cached pages.<br />
<a href="http://webkit.org/blog/427/webkit-page-cache-i-the-basics/" rel="nofollow">http://webkit.org/blog/427/webkit-page-cache-i-the-basics/</a></p>
<p>In any event, the onunload event should fire before a new page starts loading.  Double check the timing, there could be another issue causing the problems you&#8217;re seeing.</p>
<p>Thanks,<br />
Zach</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramesh</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-1700</link>
		<dc:creator>Ramesh</dc:creator>
		<pubDate>Tue, 27 Oct 2009 18:18:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-1700</guid>
		<description>Hi Zach Leatherman,

  The code you put inside the onunload event handler would be executed only after the browser unloads the page. In my case, I have an synchronous AJAX request in unload event. when the user clicks the back button I had to remove the user&#039;s session using that ajax request. But the result is, the browser first send the request to the back button first (previous page)  and once its gets the response for the request then only it starts executing the ajax method.  I would like to hear your comments on this.

Thanks,
Ramesh</description>
		<content:encoded><![CDATA[<p>Hi Zach Leatherman,</p>
<p>  The code you put inside the onunload event handler would be executed only after the browser unloads the page. In my case, I have an synchronous AJAX request in unload event. when the user clicks the back button I had to remove the user&#8217;s session using that ajax request. But the result is, the browser first send the request to the back button first (previous page)  and once its gets the response for the request then only it starts executing the ajax method.  I would like to hear your comments on this.</p>
<p>Thanks,<br />
Ramesh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to Use onbeforeunload with Form Submit Buttons &#124; I Love Bonnie.net</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-1686</link>
		<dc:creator>How to Use onbeforeunload with Form Submit Buttons &#124; I Love Bonnie.net</dc:creator>
		<pubDate>Wed, 23 Sep 2009 17:17:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-1686</guid>
		<description>[...] it&#8217;s evil to make it hard for a user to leave a page, I&#8217;m not here to argue the merits (or lack thereof) of [...]</description>
		<content:encoded><![CDATA[<p>[...] it&#8217;s evil to make it hard for a user to leave a page, I&#8217;m not here to argue the merits (or lack thereof) of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Leatherman</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-1474</link>
		<dc:creator>Zach Leatherman</dc:creator>
		<pubDate>Thu, 13 Aug 2009 23:17:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-1474</guid>
		<description>Olivier, that&#039;s a very good idea, if the browser supports it!  Considering that most of the modern ones do, it might be worthwhile to store locally if available, and then just use onbeforeunload if not.  No sense in doing too much work for those old browsers.</description>
		<content:encoded><![CDATA[<p>Olivier, that&#8217;s a very good idea, if the browser supports it!  Considering that most of the modern ones do, it might be worthwhile to store locally if available, and then just use onbeforeunload if not.  No sense in doing too much work for those old browsers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-1444</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Wed, 12 Aug 2009 17:21:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-1444</guid>
		<description>And what about storing the datas on the client with the new dom storage API instead of the server ? Hoping more browsers will implement this feature soon.</description>
		<content:encoded><![CDATA[<p>And what about storing the datas on the client with the new dom storage API instead of the server ? Hoping more browsers will implement this feature soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Leatherman</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-1001</link>
		<dc:creator>Zach Leatherman</dc:creator>
		<pubDate>Tue, 09 Jun 2009 03:18:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-1001</guid>
		<description>As with every development decision, you have to weigh the cost of development against the benefit you get.  If you think it&#039;s a better cost-benefit to use onbeforeunload, go for it.  I just don&#039;t think it&#039;s a very &lt;b&gt;usable&lt;/b&gt; solution.</description>
		<content:encoded><![CDATA[<p>As with every development decision, you have to weigh the cost of development against the benefit you get.  If you think it&#8217;s a better cost-benefit to use onbeforeunload, go for it.  I just don&#8217;t think it&#8217;s a very <b>usable</b> solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tore B. Krudtaa</title>
		<link>http://www.zachleat.com/web/dont-let-the-door-hit-you-onunload-and-onbeforeunload/comment-page-1/#comment-997</link>
		<dc:creator>Tore B. Krudtaa</dc:creator>
		<pubDate>Sun, 07 Jun 2009 08:05:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/?p=126#comment-997</guid>
		<description>Here is my view on it.

Let say you have developed a web application for your customer where the customer is using the web app. on a daily basis in their work.
And they do not want to loose data or have to retype anything because they forgot to save the page before leaving it.

They do a lot of entering of new data, changing data in the form etc... before submitting to server.

Sometimes they actually do forget to save the form/page.

I have several such web applications for customers where I use the onbeforeunload together with some javascript that test if the form was changed.
So if the client try to leave a page that has been changed but not saved, then he will get a warning that gives him the option to stay on the page (then he can save the changes), or to continue leaving the page.

In my opinion the onbeforeunload is a really nice feature.
And it is a pity that opera has nada support for it.

Implementing your solution might be doable, but in my opinion it is much better to give the client the choice there and then.
Using your solution will also cost more for the customer since you will have to write some client and backend code to handle that for each of the forms used.

Using the onbeforeunload with some javascript to check if the form was changed are supereasy to implement, and only has to be implemented on the client side.

Why not let the developer choose and pick what he finds best for his application and customer.

Because of the nada support for onbeforeunload in Opera, in my customers web applications we test which browser and version that client is using when loggin in to the web app. If using Opera then the user is denied access to the site.

Browsers that have good support for the onbeforeunload event are:
IE
Firefox
Safari
Chrome
even Netscape, but who uses it
(did not test any other browsers)</description>
		<content:encoded><![CDATA[<p>Here is my view on it.</p>
<p>Let say you have developed a web application for your customer where the customer is using the web app. on a daily basis in their work.<br />
And they do not want to loose data or have to retype anything because they forgot to save the page before leaving it.</p>
<p>They do a lot of entering of new data, changing data in the form etc&#8230; before submitting to server.</p>
<p>Sometimes they actually do forget to save the form/page.</p>
<p>I have several such web applications for customers where I use the onbeforeunload together with some javascript that test if the form was changed.<br />
So if the client try to leave a page that has been changed but not saved, then he will get a warning that gives him the option to stay on the page (then he can save the changes), or to continue leaving the page.</p>
<p>In my opinion the onbeforeunload is a really nice feature.<br />
And it is a pity that opera has nada support for it.</p>
<p>Implementing your solution might be doable, but in my opinion it is much better to give the client the choice there and then.<br />
Using your solution will also cost more for the customer since you will have to write some client and backend code to handle that for each of the forms used.</p>
<p>Using the onbeforeunload with some javascript to check if the form was changed are supereasy to implement, and only has to be implemented on the client side.</p>
<p>Why not let the developer choose and pick what he finds best for his application and customer.</p>
<p>Because of the nada support for onbeforeunload in Opera, in my customers web applications we test which browser and version that client is using when loggin in to the web app. If using Opera then the user is denied access to the site.</p>
<p>Browsers that have good support for the onbeforeunload event are:<br />
IE<br />
Firefox<br />
Safari<br />
Chrome<br />
even Netscape, but who uses it<br />
(did not test any other browsers)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

