<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Programming Ideas, Logics, Tips and Tricks &#187; confirm</title>
	<atom:link href="http://www.sajithmr.me/tag/confirm/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sajithmr.me</link>
	<description></description>
	<lastBuildDate>Mon, 23 Jan 2012 15:44:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Warning before navigate away from a page</title>
		<link>http://www.sajithmr.me/warning-before-navigate-away-from-a-page</link>
		<comments>http://www.sajithmr.me/warning-before-navigate-away-from-a-page#comments</comments>
		<pubDate>Sat, 19 Jul 2008 15:27:07 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[away]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[close]]></category>
		<category><![CDATA[confirm]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[navigate]]></category>
		<category><![CDATA[save]]></category>
		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/warning-before-navigate-away-from-a-page/</guid>
		<description><![CDATA[In some cases, if you are in between any work of editing or typing a content, and you wont let the visitor to navigate away from the page without particular condition, say the document is not saved yet, you can block the navigation (even the closing of the browser window) with Javascript. Here is the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.sajithmr.com/wp-content/uploads/2008/07/man.jpg" style="margin: 10px; float: left" /></p>
<p>In some cases, if you are in between any work of editing or typing a content, and you wont let the visitor to navigate away from the page without particular condition, say the document is not saved yet, you can block the navigation (even the closing of the browser window)  with Javascript.</p>
<p>Here is the javascript code for that:</p>
<p><font color="#808080"><br />
<font color="#808000">&lt;script&gt;</font></font></p>
<p><font color="#808080"><font color="#808000">window.onbeforeunload = function (evt) {<br />
var message = &#8216;Are you sure you want to leave?&#8217;;<br />
if (typeof evt == &#8216;undefined&#8217;) {<br />
evt = window.event;<br />
}<br />
if (evt) {<br />
evt.returnValue = message;<br />
}<br />
return message;<br />
}</font></font></p>
<p><font color="#808080"><font color="#808000">&lt;/script&gt; </font></font></p>
<p>Just paste this code anywhere in your html page. The condition settings , warning messages are up to you. In the above code, the warning will be displayed when ever a navigation happen (Even closing of browser window happen)</p>
<p><img src="http://www.sajithmr.com/wp-content/uploads/2008/07/confirmation.png" /></p>
<p>(pic from Binney V.A)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/warning-before-navigate-away-from-a-page/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

