<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;Ck4NQH8_eyp7ImA9WhBbGE8.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949</id><updated>2013-05-18T01:33:11.143+05:30</updated><category term="duplicate id" /><category term="parseInt" /><category term="flash" /><category term="dialog" /><category term="solution" /><category term="documentation" /><category term="html5" /><category term="bug" /><category term="books" /><category term="dom inspector" /><category term="data-prefetch" /><category term="conditions" /><category term="settings" /><category term="nan" /><category term="chrome" /><category term="ntpdate" /><category term="autofocus" /><category term="data-title" /><category term="rhel" /><category term="firefox" /><category term="DOM" /><category term="yum" /><category term="DOM cache" /><category term="css" /><category term="quick" /><category term="publish" /><category term="url frame" /><category term="jqm" /><category term="function" /><category term="custom transition" /><category term="performance" /><category term="tv" /><category term="semantics" /><category term="hwclock" /><category term="jquery mobile" /><category term="sysconfig" /><category term="turn" /><category term="reverse" /><category term="opera" /><category term="qml" /><category term="gravatar" /><category term="java" /><category term="transition" /><category term="arrays" /><category term="data-dom-cache" /><category term="best practices" /><category term="title" /><category term="cloud" /><category term="Ajax transitions" /><category term="data-direction" /><category term="page" /><category term="timezone" /><category term="global" /><category term="android" /><category term="patent" /><category term="data-url" /><category term="emulator" /><category term="graceful degradation" /><category term="browser engine" /><category term="reference" /><category term="code inspector" /><category term="browser share" /><category term="H.264" /><category term="Qt" /><category term="stats" /><category term="virtual box" /><category term="primitives" /><category term="necessitas" /><category term="html5test" /><category term="page transition" /><category term="url redirect" /><category term="google" /><category term="node.js" /><category term="whitespace" /><category term="radix" /><category term="javascript" /><category term="self invoking" /><category term="spec" /><category term="red hat" /><category term="data-ajax" /><category term="eval" /><category term="data-transition" /><category term="conference" /><category term="demo" /><category term="sync" /><category term="rpm" /><category term="flow" /><category term="jQueryMobile" /><category term="ui-loader" /><category term="comparison" /><category term="data-role" /><category term="codec" /><category term="transitions" /><category term="infinity" /><category term="unique id" /><category term="recommendations" /><category term="data-rel" /><category term="linux" /><category term="rendering" /><category term="kde.in" /><category term="speed" /><category term="navigation" /><category term="extensions" /><category term="falsy" /><category term="multi-page template" /><category term="loops" /><category term="ajax" /><category term="logger" /><category term="header" /><category term="howto" /><category term="developer tools" /><category term="couch db" /><category term="undefined" /><category term="bookmarks" /><category term="book" /><category term="blog" /><category term="page title" /><category term="mobile app" /><category term="jmeter" /><category term="time" /><category term="strict" /><category term="page id" /><category term="IE" /><category term="single-page template" /><category term="truthy" /><category term="node.js npm ubuntu install upgrade" /><category term="profile" /><title>Developer</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://dev.chetankjain.net/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Chetan Jain</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><feedburner:info uri="chetankjain/jlkt" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/TheChetankjainDevBlog" /><feedburner:info uri="thechetankjaindevblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>TheChetankjainDevBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;CEAEQn89fyp7ImA9WhNaFU8.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-4027435101680774459</id><published>2013-01-30T10:41:00.000+05:30</published><updated>2013-01-30T10:41:43.167+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-30T10:41:43.167+05:30</app:edited><title>Winners of the jQuery Mobile Cookbook giveaway</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;I had earlier announced that I would be giving away 2 copies of my book, jQuery Mobile Cookbook &lt;a href="http://dev.chetankjain.net/2012/12/sweepstakes-giving-away-2-free-copies.html" target="_blank"&gt;here&lt;/a&gt;. I wish to thank all the participants who sent in their entries from across the world. Thrilled by your response.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Due to unavoidable circumstances, there was a delay in me procuring the books and so I was not able to announce the winners sooner. But now here they are:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif; font-size: x-large;"&gt;Congratulations !!!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif; font-size: x-large;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Winner of the hard copy from India:&amp;nbsp;&lt;/span&gt;&lt;i style="background-color: white; color: #222222; font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Vasudevan P&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Winner of the e-book from Spain:&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #222222;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;i&gt;&lt;b&gt;Miguel Angel&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;The two winners were randomly chosen by me without any bias and have been informed by direct email. They will be receiving their copies soon. The decision is final and not subject to review or contest.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Thanks again to all those who participated!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Link to the book:&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.packtpub.com/jquery-mobile-cookbook/book" style="font-family: Verdana, sans-serif;"&gt;http://www.packtpub.com/jquery-mobile-cookbook/book&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.packtpub.com/sites/default/files/7225OS_jQuery%20Mobile%20Cookbook.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://www.packtpub.com/sites/default/files/7225OS_jQuery%20Mobile%20Cookbook.jpg" width="258" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Extract from the publisher website:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Overview:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="background-color: white; border: 0px; font-family: sans-serif; font-size: 12px; font: inherit; line-height: 18px; list-style: none; margin: 0px; padding: 0px;"&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Create applications that use custom animations and use various techniques to improve application performance&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use and customize the various controls such as toolbars, buttons, and lists with custom icons, icon sprites, styles, and themes&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Write simple but powerful scripts to manipulate the various configurations and work with the events, methods, and utilities which are provided by the framework&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;What you will learn from this book:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="background-color: white; border: 0px; font-family: sans-serif; font-size: 12px; font: inherit; line-height: 18px; list-style: none; margin: 0px; padding: 0px;"&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Create single-page and multi-page applications that use custom CSS and JavaScript transitions; improve performance using Prefetch, DOM-Cache, and Application Cache&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use fixed and full screen toolbars, navbars, and buttons; customize them with your own icons, icon sprites, and styles&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use XML and JSON data in your application; format page content using layout grids, collapsibles, and nested accordions&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Build accessible forms; use form controls like flip switches, sliders, and select menus; validate and submit forms using Ajax&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use various types of lists such as Inset, Numbered, Nested, Read-only, and Split Button lists; manipulate lists using JavaScript&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use JavaScript to dynamically create and initialize controls, load and change pages, handle events; tweak and customize the framework configurations&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Explore HTML5 semantics and features such as Local Storage, Session Storage, History, 2D Canvas, 3D, Geolocation, Web Workers, Audio, and Video&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use custom fonts and backgrounds, upgrade themes, override existing themes; generate and share new themes using the Theme Roller tool&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/qM7b3shwCko" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/_WHlAzV6V70" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/4027435101680774459/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2013/01/winners-of-jquery-mobile-cookbook.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/4027435101680774459?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/4027435101680774459?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/_WHlAzV6V70/winners-of-jquery-mobile-cookbook.html" title="Winners of the jQuery Mobile Cookbook giveaway" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://dev.chetankjain.net/2013/01/winners-of-jquery-mobile-cookbook.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/qM7b3shwCko/winners-of-jquery-mobile-cookbook.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIBRH09eSp7ImA9WhNXGUg.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-3620031595780651450</id><published>2012-12-08T12:41:00.000+05:30</published><updated>2012-12-08T14:35:55.361+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-08T14:35:55.361+05:30</app:edited><title>Giving away 2 free copies of  jQuery Mobile Cookbook</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;I wish to thank all my friends, readers and well wishers. Your constant encouragement and support helped me complete my very first published book. I'm now very glad to announce that my book &lt;b&gt;jQuery Mobile Cookbook&lt;/b&gt; just got published by Packt Publishers. The link is here:&amp;nbsp;&lt;a href="http://www.packtpub.com/jquery-mobile-cookbook/book"&gt;http://www.packtpub.com/jquery-mobile-cookbook/book&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.packtpub.com/sites/default/files/7225OS_jQuery%20Mobile%20Cookbook.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://www.packtpub.com/sites/default/files/7225OS_jQuery%20Mobile%20Cookbook.jpg" width="258" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Extract from the publisher website:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Overview:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="background-color: white; border: 0px; font-family: sans-serif; font-size: 12px; font: inherit; line-height: 18px; list-style: none; margin: 0px; padding: 0px;"&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Create applications that use custom animations and use various techniques to improve application performance&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use and customize the various controls such as toolbars, buttons, and lists with custom icons, icon sprites, styles, and themes&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Write simple but powerful scripts to manipulate the various configurations and work with the events, methods, and utilities which are provided by the framework&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;What you will learn from this book:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="background-color: white; border: 0px; font-family: sans-serif; font-size: 12px; font: inherit; line-height: 18px; list-style: none; margin: 0px; padding: 0px;"&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Create single-page and multi-page applications that use custom CSS and JavaScript transitions; improve performance using Prefetch, DOM-Cache, and Application Cache&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use fixed and full screen toolbars, navbars, and buttons; customize them with your own icons, icon sprites, and styles&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use XML and JSON data in your application; format page content using layout grids, collapsibles, and nested accordions&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Build accessible forms; use form controls like flip switches, sliders, and select menus; validate and submit forms using Ajax&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use various types of lists such as Inset, Numbered, Nested, Read-only, and Split Button lists; manipulate lists using JavaScript&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use JavaScript to dynamically create and initialize controls, load and change pages, handle events; tweak and customize the framework configurations&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Explore HTML5 semantics and features such as Local Storage, Session Storage, History, 2D Canvas, 3D, Geolocation, Web Workers, Audio, and Video&lt;/li&gt;
&lt;li style="border: 0px; font-size: 12px; font: inherit; line-height: 1.5em; list-style-image: url(http://cdn2.cf.packtpub.com/sites/default/files/new-design-assets/orange-bullet.png); list-style-type: disc; margin: 0px 0px 0px 2em; padding: 0px;"&gt;Use custom fonts and backgrounds, upgrade themes, override existing themes; generate and share new themes using the Theme Roller tool&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;You can purchase the book directly from the Packt website (link above). The book is also available on all popular stores and also online at Amazon, Safari Books Online, Barnes and Nobles, Flipkart, BookAdda to mention a few...&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;i&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"&gt;!!! Now comes the best part !!!&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;i&gt;One lucky winner from anywhere in the world will get a free ebook copy.&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;i&gt;One lucky winner from anywhere in India will get a free printed copy.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;So rush now. Send me a direct email at &lt;a href="mailto:chetankjain@gmail.com"&gt;chetankjain@gmail.com&lt;/a&gt;&amp;nbsp;with the below subject.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Email Subject:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;From &amp;lt;Country Name&amp;gt;, I want to read the jQuery Mobile Cookbook&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;e.g.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;From India, I want to read the jQuery Mobile Cookbook&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;The two winners will be randomly chosen by me without any bias and announced on this site and by direct email, within 1 week after the last date of submission of the entries. The winners will be decided at my sole discretion. The decision will be final and not subject to review or contest.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Last day to participate and send in your email is GMT Midnight Sunday Dec 16, 2012.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/2VXJOddcDfg" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/WRXMEIEGT74" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/3620031595780651450/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2012/12/sweepstakes-giving-away-2-free-copies.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/3620031595780651450?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/3620031595780651450?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/WRXMEIEGT74/sweepstakes-giving-away-2-free-copies.html" title="Giving away 2 free copies of  jQuery Mobile Cookbook" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://dev.chetankjain.net/2012/12/sweepstakes-giving-away-2-free-copies.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/2VXJOddcDfg/sweepstakes-giving-away-2-free-copies.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcERHc4eCp7ImA9WhVUEk8.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-533433571877696457</id><published>2012-05-17T09:06:00.002+05:30</published><updated>2012-05-17T09:10:05.930+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-17T09:10:05.930+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="node.js npm ubuntu install upgrade" /><title>Node.js: Notes on Install and Upgrade on Ubuntu</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
To install Node.js, first install the below prerequisite and add the node.js repository.&lt;/div&gt;
&lt;pre style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;code&gt;# sudo apt-get install python-software-properties
# sudo apt-add-repository ppa:chris-lea/node.js&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;code&gt;&lt;/code&gt;Now install Node.js and npm (the Node Packet Manager).&lt;/pre&gt;
&lt;pre style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;code&gt;# sudo apt-get update
# sudo apt-get install nodejs npm&lt;/code&gt;&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;code&gt;&lt;/code&gt;Thats it. Your Node.js is ready. Test by running the below command.&lt;/pre&gt;
&lt;pre style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;code&gt;# node -v&lt;/code&gt;&lt;/pre&gt;
&lt;pre style="color: blue; font-family: Arial,Helvetica,sans-serif;"&gt;&lt;i&gt;&lt;code&gt;v0.6.18&lt;/code&gt;&lt;/i&gt;&lt;/pre&gt;
&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;code&gt;&lt;/code&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Node.js stable releases &lt;/span&gt;&lt;code style="font-family: Verdana,sans-serif;"&gt;&lt;/code&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;are done quite frequently. To upgrade run,&lt;/span&gt;&lt;/pre&gt;
&lt;div style="color: blue;"&gt;
&lt;code&gt;# sudo apt-get update&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;code style="color: blue;"&gt;# sudo apt-get upgrade nodejs npm &lt;/code&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;code&gt;&lt;/code&gt;You could also use the Ubuntu Update Manager to do the update.&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;If you are the kind who prefers to directly build from the sources then,&lt;/pre&gt;
&lt;pre style="color: blue; font-family: Verdana,sans-serif;"&gt;&lt;code&gt;# cd &amp;lt;directory&amp;gt;&lt;/code&gt;
&lt;code&gt;# sudo wget http://nodejs.org/dist/v0.6.18/node-v0.6.18.tar.gz&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style="color: blue;"&gt;
&lt;code&gt;# sudo tar -zxf node-v0.6.18.tar.gz&lt;/code&gt;&lt;/div&gt;
&lt;div style="color: blue;"&gt;
&lt;code&gt;# cd node-v0.6.18 &lt;/code&gt;&lt;/div&gt;
&lt;div style="color: blue;"&gt;
&lt;code&gt;# sudo ./configure&lt;/code&gt;&lt;/div&gt;
&lt;div style="color: blue;"&gt;
&lt;code&gt;# sudo make&lt;/code&gt;&lt;/div&gt;
&lt;div style="color: blue;"&gt;
&lt;code&gt;# sudo make install&lt;/code&gt;&lt;/div&gt;
&lt;div style="color: blue;"&gt;
&lt;code&gt;# node -v&lt;/code&gt;&lt;/div&gt;
&lt;pre style="color: blue; font-family: Arial,Helvetica,sans-serif;"&gt;&lt;i&gt;&lt;code&gt;v0.6.18&lt;/code&gt;&lt;/i&gt;&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;code&gt;&lt;/code&gt;The latest version was v0.6.18 at the time of writing this post.&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;/pre&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;For other platforms, installation is simple. See the &lt;a href="https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager" target="_blank"&gt;Node.js installation web page&lt;/a&gt;.&lt;/pre&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/7iC0msf5Kf4" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/jcEERxSFY5Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/533433571877696457/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2012/05/nodejs-notes-on-install-and-upgrade-on.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/533433571877696457?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/533433571877696457?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/jcEERxSFY5Y/nodejs-notes-on-install-and-upgrade-on.html" title="Node.js: Notes on Install and Upgrade on Ubuntu" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://dev.chetankjain.net/2012/05/nodejs-notes-on-install-and-upgrade-on.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/7iC0msf5Kf4/nodejs-notes-on-install-and-upgrade-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8BQnY6eSp7ImA9WhVWEkw.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-6513669874001238648</id><published>2012-04-24T03:37:00.000+05:30</published><updated>2012-04-24T03:37:33.811+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-24T03:37:33.811+05:30</app:edited><title>Ubuntu: Easy steps to install and use Notepad++ and IE on Ubuntu</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
I like using Notepad++, but it is a windows program and is not available for Linux. There are some jQuery Mobile apps that I need to test on IE. I need a Windows platform. But my primary laptop has Ubuntu.&lt;br /&gt;
&lt;br /&gt;
The solution is to use Wine and boy does it taste good!&lt;br /&gt;
&lt;br /&gt;
First install wine&lt;br /&gt;
&lt;div style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;
# sudo apt-get install wine&lt;/div&gt;
&lt;br /&gt;
Download the latest notepad++ installer from &lt;a href="http://notepad-plus-plus.org/"&gt;http://notepad-plus-plus.org/&lt;/a&gt; and launch it using wine.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;
# sudo wine &amp;lt;download folder&amp;gt;/npp.xxx.Installer.exe&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This will launch the Npp installer and you can complete the fairly simple installation. Thats it, you are done !&lt;br /&gt;
&lt;br /&gt;
Now you can just launch Npp and its a touchdown !&lt;br /&gt;
&lt;div style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;
# cd ~/.wine/drive_c/Program Files/Notepad++&lt;/div&gt;
&lt;div style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;
&lt;/div&gt;
&lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# ./notepad++.exe &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
There is a version of IE available too&amp;nbsp; &lt;br /&gt;
&lt;div style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;
# cd ~/.wine/drive_c/Program Files/Internet Explorer &lt;/div&gt;
&lt;div style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;
# ./iexplore.exe&lt;/div&gt;
&lt;br /&gt;
This IE scores pretty decent on &lt;a href="http://www.html5test.com/"&gt;www.html5test.com&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Now how about try installing other Windows apps on Ubuntu and having more fun...&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/KsCZ_nvb2xo" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/YZSC4lJGsF4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/6513669874001238648/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2012/04/ubuntu-easy-steps-to-install-and-use.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6513669874001238648?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6513669874001238648?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/YZSC4lJGsF4/ubuntu-easy-steps-to-install-and-use.html" title="Ubuntu: Easy steps to install and use Notepad++ and IE on Ubuntu" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://dev.chetankjain.net/2012/04/ubuntu-easy-steps-to-install-and-use.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/KsCZ_nvb2xo/ubuntu-easy-steps-to-install-and-use.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0cAQH08fip7ImA9WhNaFUk.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-9080972954276775787</id><published>2012-04-10T23:43:00.001+05:30</published><updated>2013-01-30T16:54:01.376+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-30T16:54:01.376+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="timezone" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="sysconfig" /><category scheme="http://www.blogger.com/atom/ns#" term="rhel" /><category scheme="http://www.blogger.com/atom/ns#" term="time" /><category scheme="http://www.blogger.com/atom/ns#" term="red hat" /><category scheme="http://www.blogger.com/atom/ns#" term="ntpdate" /><category scheme="http://www.blogger.com/atom/ns#" term="hwclock" /><title>Fixing Date, Time and Zone on RHEL 6 command line</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Had to fix all time related issues on a remote RHEL 6 server which runs without any windowing system. Plain ol' command line. Documenting steps here for future reference:&lt;br /&gt;
&lt;br /&gt;
Check to see if your date and timezone settings are accurate:&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# date&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# cat /etc/sysconfig/clock&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The server I accessed had wrong settings for both the commands. Here are the steps I used to correct:&lt;br /&gt;
&lt;br /&gt;
Find out your timezone from the folder /usr/share/zoneinfo&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# ls /usr/share/zoneinfo&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Mine was pointing to America/EDT instead of&amp;nbsp;&lt;span style="color: #274e13; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;i&gt;Asia/Calcutta&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Update and save the /etc/sysconfig/clock file to&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# sudo vi /etc/sysconfig/clock&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #274e13; font-family: 'Courier New', Courier, monospace;"&gt;&lt;i&gt;&lt;b&gt;ZONE="Asia/Calcutta"&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #274e13; font-family: 'Courier New', Courier, monospace;"&gt;&lt;i&gt;&lt;b&gt;UTC=true&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #274e13; font-family: 'Courier New', Courier, monospace;"&gt;&lt;i&gt;&lt;b&gt;ARC=false&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Remove the /etc/localtime&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# sudo rm /etc/localtime&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Create a new soft link to your time zone&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# cd /etc&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# sudo ln -s /usr/share/zoneinfo/Asia/Calcutta /etc/localtime&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# ls -al localtime&lt;/span&gt;&lt;br /&gt;
Now it should show the link to your time zone&lt;br /&gt;
&lt;br /&gt;
Set your hardware clock to UTC&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# sudo hwclock --systohc --utc&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# hwclock --show&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Update your time from a NTP server (Red Hat NTP server used here)&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# sudo&amp;nbsp;ntpdate clock.redhat.com&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #274e13; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;i&gt;10 Apr 22:08:27 ntpdate[25695]: adjust time server 66.187.233.4 offset 0.004185 sec&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Finally verify the date now&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;#date --utc&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #274e13; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;i&gt;Tue Apr 10 16:39:56 UTC 2012&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;#date&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #274e13; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;i&gt;Tue Apr 10 22:09:58 IST 2012&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Add the above ntpdate command in your server startup script or in a cron job to automatically set the system time. The list of ntp servers can be found here:&amp;nbsp;&lt;a href="https://support.ntp.org/bin/view/Servers/StratumOneTimeServers"&gt;https://support.ntp.org/bin/view/Servers/StratumOneTimeServers&lt;/a&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/laVzMV6D2hE" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/LPlimHU63Oo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/9080972954276775787/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2012/04/fixing-date-time-and-zone-on-rhel-6.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/9080972954276775787?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/9080972954276775787?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/LPlimHU63Oo/fixing-date-time-and-zone-on-rhel-6.html" title="Fixing Date, Time and Zone on RHEL 6 command line" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>8</thr:total><feedburner:origLink>http://dev.chetankjain.net/2012/04/fixing-date-time-and-zone-on-rhel-6.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/laVzMV6D2hE/fixing-date-time-and-zone-on-rhel-6.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUNQ384cSp7ImA9WhVXEEU.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-7901411598217813509</id><published>2012-03-26T16:06:00.004+05:30</published><updated>2012-04-10T23:54:52.139+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-10T23:54:52.139+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="rpm" /><category scheme="http://www.blogger.com/atom/ns#" term="couch db" /><category scheme="http://www.blogger.com/atom/ns#" term="rhel" /><category scheme="http://www.blogger.com/atom/ns#" term="red hat" /><category scheme="http://www.blogger.com/atom/ns#" term="yum" /><title>CouchDB on RHEL6 (Red Hat Enterprise Linux)</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;Had to install a Couch DB instance on a fresh Red Hat Enterprise 6 Linux Box and it required some time before I got the whole thing up.&amp;nbsp;Better have it documented here for future reference:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;1. Get the Prerequisites&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;First you will have to add the RPM Forge YUM Repository if not already available. Add the new repo:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo vi /etc/yum.repos.d/rpmforge.repo&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# Name: RPMforge RPM Repository for Red Hat Enterprise 6 - dag&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# URL: http://rpmforge.net/&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;# (Put "x86_64" instead of "i386" if appropriate.)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;[rpmforge]&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;name = Red Hat Enterprise $releasever - RPMforge.net - dag&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;baseurl = ftp://ftp.pbone.net/mirror/atrpms.net/el6-i386/atrpms/stable&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;enabled = 1&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;protect = 0&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;gpgcheck = 0&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;Save the file and get the prerequisites:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo yum clean all&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo yum install \&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; cvs zip gcc-c++ glib2-devel gtk2-devel fontconfig-devel libnotify-devel \&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; libIDL-devel alsa-lib-devel libXt-devel freetype-devel pkgconfig \&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; dbus-glib-devel curl-devel autoconf213 xorg-x11-proto-devel libX11-devel \&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; libXau-devel libXext-devel wireless-tools-devel glibc-static libstdc++-static \&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; yasm&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;mesa-libGL-devel esound-libs esound-devel ccache mercurial glibc-devel \&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; ncurses-devel openssl-devel libicu-devel erlang js-devel libtool which make&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;If Mercurial is not found, you can install a RPM package from RPMForge using the below commands&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;(replace VERSION with your version/architecture):&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo wget http://packages.sw.be/mercurial/mercurial-VERSION.rpm&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo rpm -Uhv mercurial-VERSION.rpm&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;If curl was not found, install from sources&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo wget http://curl.haxx.se/download/curl-7.20.1.tar.gz&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo tar -xzf curl-7.20.1.tar.gz&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;cd curl-7.20.1&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo ./configure --prefix=/usr/local&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo make&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo make test&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo make install&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;If Erlang was not found, download, build and install Erlang:&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo wget http://erlang.org/download/otp_src_R14B03.tar.gz&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo tar zxvf otp_src_R14B03.tar.gz&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo cd otp_src_R14B03&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo ./configure &amp;amp;&amp;amp; sudo make &amp;amp;&amp;amp; sudo make install&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;If js-dev (SpiderMonkey) was not found, build from the source files&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo mkdir mozilla&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo cd mozilla&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo tar xzf js185-1.0.0.tar.gz&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;cd js/src&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo autoconf-2.13&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo ./configure&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo make&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo make install&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;2. Install CouchDB&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;Now you are ready to install CouchDB from sources. The configure line below is for 64-bit, adjust for your arch (or leave out --with-erlang if configure can find out for itself). You can use a release tarball instead of a checkout, in that case skip right to the ./confgure line.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo svn checkout http://svn.apache.org/repos/asf/couchdb/trunk couchdb&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;cd couchdb&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo ./bootstrap&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo ./configure --with-erlang=/usr/lib64/erlang/usr/include --with-js-lib=/usr/local/lib/ --with-js-include=/usr/local/include/js/&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo make&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo make install&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;3. Configure CouchDB&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
a.&amp;nbsp;Edit config file to your need, change the port etc&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo vi /usr/local/etc/couchdb/local.ini&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
b. Create user, modify ownership and permissions&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo groupadd -r couchdb&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo adduser -r -d /usr/local/var/lib/couchdb -M \&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; -s /bin/bash -g couchdb couchdb&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
c. fix permission&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo chown -R couchdb: /usr/local/var/lib/couchdb /usr/local/var/log/couchdb&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. Launch CouchDB&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo -u couchdb couchdb&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Or as daemon:&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo /usr/local/etc/rc.d/couchdb start&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Or at startup as a daemon:&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo chkconfig --add couchdb&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;sudo chkconfig --level 345 couchdb on&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5. Test Install:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now you should see something meaningful when you click&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;http://127.0.0.1:5984/_utils/index.html&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/SMMAoKEuAK8" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/J9W1r0PzbJ8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/7901411598217813509/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2012/03/couchdb-on-rhel6-red-hat-enterprise.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/7901411598217813509?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/7901411598217813509?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/J9W1r0PzbJ8/couchdb-on-rhel6-red-hat-enterprise.html" title="CouchDB on RHEL6 (Red Hat Enterprise Linux)" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://dev.chetankjain.net/2012/03/couchdb-on-rhel6-red-hat-enterprise.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/SMMAoKEuAK8/couchdb-on-rhel6-red-hat-enterprise.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEAQn49fyp7ImA9WhVTEk0.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-383937627360266123</id><published>2012-02-18T15:43:00.002+05:30</published><updated>2012-02-26T02:30:43.067+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-26T02:30:43.067+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="transitions" /><category scheme="http://www.blogger.com/atom/ns#" term="documentation" /><category scheme="http://www.blogger.com/atom/ns#" term="demo" /><category scheme="http://www.blogger.com/atom/ns#" term="custom transition" /><category scheme="http://www.blogger.com/atom/ns#" term="turn" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><category scheme="http://www.blogger.com/atom/ns#" term="flow" /><title>2 new Page Transitions in jQuery Mobile v1.1</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span style="text-align: left;"&gt;In my &lt;/span&gt;&lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-page-transitions-simple.html" style="text-align: left;" target="_blank"&gt;earlier post&lt;/a&gt;&lt;span style="text-align: left;"&gt; I had written a simple demo to show the various transitions that are available with jQuery Mobile. The official documentation v1.0.1 for page transitions is available &lt;/span&gt;&lt;a href="http://jquerymobile.com/demos/1.0.1/docs/pages/page-transitions.html" style="text-align: left;" target="_blank"&gt;here&lt;/a&gt;&lt;span style="text-align: left;"&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
But with jQuery Mobile v1.1, the &lt;a href="http://jquerymobile.com/test/docs/pages/page-transitions.html" target="_blank"&gt;official documentation&lt;/a&gt; has been updated and is much better compared to the older version. You will also see the page looks much simpler and showcases how the transitions would look for pages and also dialogs. Just click on the buttons and you can see the live demo. Excellent work on updating the documentation.&lt;br /&gt;
&lt;br /&gt;
Also very exciting to see that two new transitions have been added, the &lt;b&gt;Turn &lt;/b&gt;and the &lt;b&gt;Flow&lt;/b&gt;. So now we have a total of 8 transitions that are available by default. Pretty cool.&lt;br /&gt;
&lt;br /&gt;
Of course the brave can extend the framework and try to create their own custom transitions using CSS3 and JS.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/JHi4ZVwgixY" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/uaf0N_G38ho" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/383937627360266123/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2012/02/2-new-page-transitions-in-jquery-mobile.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/383937627360266123?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/383937627360266123?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/uaf0N_G38ho/2-new-page-transitions-in-jquery-mobile.html" title="2 new Page Transitions in jQuery Mobile v1.1" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://dev.chetankjain.net/2012/02/2-new-page-transitions-in-jquery-mobile.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/JHi4ZVwgixY/2-new-page-transitions-in-jquery-mobile.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIHSHY9eSp7ImA9WhRaGUs.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-2734163689448645392</id><published>2012-02-16T21:26:00.000+05:30</published><updated>2012-02-23T08:05:39.861+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-23T08:05:39.861+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="codec" /><category scheme="http://www.blogger.com/atom/ns#" term="H.264" /><category scheme="http://www.blogger.com/atom/ns#" term="emulator" /><category scheme="http://www.blogger.com/atom/ns#" term="virtual box" /><category scheme="http://www.blogger.com/atom/ns#" term="html5test" /><category scheme="http://www.blogger.com/atom/ns#" term="tv" /><category scheme="http://www.blogger.com/atom/ns#" term="opera" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><title>TV apps using jQuery Mobile</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
The idiot box finally graduates to an internet box!&lt;br /&gt;
&lt;br /&gt;
Internet on TV is catching on quite fast. I've been reading reports that predict a billion(s) dollar market that will open up for TV apps. Ah the hype .. these things are always in billions. But anyways, considering the number of people who have a TV and the number who watch it (almost everyone?), I guess this could be quite realistic.&lt;br /&gt;
&lt;br /&gt;
Many advantages I guess, lesser strain on the eyes, no burnt laps and no lost fertility with laptops on top of laps. I'm online 100% of the time. Definitely I stand to gain. My 6 year old kid too. I'd rather have him play Angry birds and all those HD games on TV compared to him holding my super heated mobile and straining his eyes watching the small screen.&lt;br /&gt;
&lt;br /&gt;
So now that I've made my point beyond all doubt, it is agreed that TV apps is the next big thing!&lt;br /&gt;
So where do I start? I do not have an Internet TV yet! Not to despair, one could install the recently launched Opera TV Emulator and have the next best thing.&lt;br /&gt;
&lt;br /&gt;
The steps are detailed &lt;a href="http://dev.opera.com/articles/view/opera-tv-emulator-getting-started/" target="_blank"&gt;here&lt;/a&gt;&amp;nbsp;and are very easy to follow. You have to get the &lt;a href="http://www.virtualbox.org/wiki/Downloads" target="_blank"&gt;Virtual Box&lt;/a&gt;&amp;nbsp;and&amp;nbsp;install it. Then get the &lt;a href="http://www.opera.com/business/tv/emulator/" target="_blank"&gt;Opera TV Emulator&lt;/a&gt;, unzip it and you are ready to go. On launching the emulator virtual machine, the Opera TV browser comes up and you will also be given a link to install the H.264 codec, this is to play the MP4 videos.&lt;br /&gt;
&lt;br /&gt;
You can now directly start browsing. Now lets get bolder. How about our first TV app. Fairly simple I would say.&lt;br /&gt;
&lt;br /&gt;
Just point the TV browser to your jQuery Mobile app and&amp;nbsp;bingo! It just works. Isn't that amazing! You code once in jQuery Mobile and the code runs on a wide variety of mobile devices, tablets, desktops and now even on TV! This is true cross platform development. There are other emulators, but from first looks, I feel Opera TV emulator is the simplest to install and use.&lt;br /&gt;
&lt;br /&gt;
Though not officially supported by jQuery Mobile, my few basic apps seemed to work fine. I even tried audio and video and they work fine. The full list of current jQuery Mobile supported browsers is available&amp;nbsp;&lt;a href="http://www.jquerymobile.com/gbs" target="_blank"&gt;here&lt;/a&gt;. No mention of any TV browsers. TV browsers need to be tested in detail with jQuery Mobile. But I find this totally exciting !&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.html5test.com/results-tv.html"&gt;http://www.html5test.com/results-tv.html&lt;/a&gt;&amp;nbsp;lists the current state of affairs in the TV browser world when it comes to HTML5 support. It sure is promising. The coming days will see these scores improve and probably match or exceed the desktop browser scores. Who wants those old computers anyways. Its the era of the mobiles and the tablets. When I pointed the Opera TV browser to html5test.com, the score was 330+6 bonus points. This score is among the top 3 after Chrome and Firefox.&lt;br /&gt;
&lt;br /&gt;
Finally, one conclusion from all this - it sure is high time I replace my old TV with an Internet TV. Suggestions ?&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/VRsbfVBxuPE" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/nIz9whPsQAU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/2734163689448645392/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2012/02/jquery-mobile-on-tv.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/2734163689448645392?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/2734163689448645392?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/nIz9whPsQAU/jquery-mobile-on-tv.html" title="TV apps using jQuery Mobile" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>7</thr:total><feedburner:origLink>http://dev.chetankjain.net/2012/02/jquery-mobile-on-tv.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/VRsbfVBxuPE/jquery-mobile-on-tv.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0EHQH87fyp7ImA9WhRaEkU.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-8456156099430320348</id><published>2012-02-09T13:05:00.000+05:30</published><updated>2012-02-15T10:23:51.107+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-15T10:23:51.107+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jQueryMobile" /><category scheme="http://www.blogger.com/atom/ns#" term="publish" /><category scheme="http://www.blogger.com/atom/ns#" term="book" /><title>It pays to blog</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
"&lt;b&gt;&lt;i&gt;See one, Make one, Teach one!&lt;/i&gt;&lt;/b&gt;" - [video:&amp;nbsp;&lt;a href="http://cdn-smooth.ms-studiosmedia.com/events/W3C/Day2/Browsers_and_Standards.mp4" target="_blank"&gt;Charles McCathieNevile (Opera)&lt;/a&gt;, see @00:19:00]&lt;br /&gt;
&lt;br /&gt;
Working on a pet project, I stumbled upon jQuery Mobile a few months ago and have been hooked on to it since then. There were quite a few things that I learnt and few more things that I discovered. I started to blog a few posts on the topic and boy does it pay to blog!&lt;br /&gt;
&lt;br /&gt;
One morning I log on to my blog and find that the traffic had jumped by a few hundred page views within a single night. I used to have just a handful of daily visits earlier. Initial thought was that some bot had tried to wreck havoc on my blog. Eventually I found the true reason. My post on &lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-prefetching-pages-demo.html" target="_blank"&gt;prefetching pages using jQuery Mobile&lt;/a&gt;, had been&amp;nbsp;&lt;a href="https://twitter.com/chetankjain/status/148751220939563009" target="_blank"&gt;retweeted by @jquerymobile&lt;/a&gt;. Traffic hasn't looked down since.&amp;nbsp;Even today the number of pageviews on a daily basis, is tenfold more than the earlier days. Its been two months now.&lt;br /&gt;
&lt;br /&gt;
Within a week of this, I got an email by a&amp;nbsp;leading international publisher asking if I were interested to write a book on jQuery Mobile. I almost fell off my seat. Mostly a new version of the famous Nigerian scam mail. I was skeptical. But a quick cross check proved otherwise. This was for real!&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.facebook.com/govirocks" target="_blank"&gt;Govind&lt;/a&gt;&amp;nbsp;my friend urged me on, "Chetan, this is once in a life time opportunity. Just take it!"&lt;br /&gt;
&lt;br /&gt;
I had to submit a proposal over the new year weekend. One of these days I'll make it up to my wife and kid for me sitting with my laptop all through the new year's eve. Couldn't have done it without their support and understanding.&lt;br /&gt;
&lt;br /&gt;
The proposal got reviewed and also got selected over two other proposals. I eventually signed the contract last month.&amp;nbsp;The book will take a few months to roll out. I expect it to be available by Q4 of 2012 (if all things go well).&amp;nbsp;This&amp;nbsp;will be an interesting experience and I am quite excited about the same.&lt;br /&gt;
&lt;br /&gt;
This also means that I have a few contractual obligations with my publisher and have to pick and choose what I blog about going forward. But there are enough topics in jQueryMobile and the HTML5 world in general and I will surely be posting more frequently now.&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/Xvr-XsBv-FQ" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/3Px7gOc-2YY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/8456156099430320348/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2012/02/it-pays-to-blog.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/8456156099430320348?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/8456156099430320348?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/3Px7gOc-2YY/it-pays-to-blog.html" title="It pays to blog" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>8</thr:total><feedburner:origLink>http://dev.chetankjain.net/2012/02/it-pays-to-blog.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/Xvr-XsBv-FQ/it-pays-to-blog.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MAQX85cSp7ImA9WhVTGUg.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-1601948749124698009</id><published>2011-12-22T13:22:00.000+05:30</published><updated>2012-03-05T20:27:20.129+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-03-05T20:27:20.129+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jqm" /><category scheme="http://www.blogger.com/atom/ns#" term="rendering" /><category scheme="http://www.blogger.com/atom/ns#" term="page id" /><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="duplicate id" /><category scheme="http://www.blogger.com/atom/ns#" term="data-url" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><category scheme="http://www.blogger.com/atom/ns#" term="browser engine" /><title>jQuery Mobile and Duplicated Page IDs</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;In the &lt;a href="http://dev.chetankjain.net/2011/12/html5-and-duplicated-element-ids.html" target="_blank"&gt;previous post&lt;/a&gt;, I touched upon how browsers safely handle duplicate IDs in a html file. Things seem to work fine for the three main uses of element IDs, i.e. linking to fragments, styling and referencing the element in javascript. The first element with matching ID is picked up and styling is done for all matches.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Now let us extend this test to the jQuery Mobile framework. You can launch the&amp;nbsp;below&amp;nbsp;multi-page code here.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: white; font-family: Verdana, sans-serif;"&gt;&lt;b style="background-color: #999999;"&gt;&amp;nbsp;&lt;a href="http://dl.dropbox.com/u/53242546/jqm-dup-ids.html" target="_blank"&gt;Launch&lt;/a&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;jQuery Mobile Duplicate IDs&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div data-role="page" id="p1"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#p2" data-role="button"&amp;gt;duplicate page id&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div data-role="page" &lt;u&gt;&lt;b&gt;&lt;span style="color: red;"&gt;id="p2"&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;a data-role="button" data-rel="back" data-direction="reverse"&amp;gt;1 1&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;a href="#p1" data-role="button" data-rel="dialog"&amp;gt;Open Dialog&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div data-role="page" &lt;u&gt;&lt;span style="color: red;"&gt;&lt;b&gt;id="p2"&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;a data-role="button" data-rel="back" data-direction="reverse"&amp;gt; 0 &amp;lt;/a&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;On load, when you click on the button, ajax is used to navigate to the page with ID p2, but here there are two IDs that match. The framework is not expecting this, and correctly so. Things go haywire. You have the resulting page rendered with seemingly garbled text, Actually both pages are rendered, but in a weird way. You will see the first button from both the pages, at the same location, merging the texts "1 &amp;nbsp;1" and " &amp;nbsp;0 &amp;nbsp;" to show "101". Then there is the second button which gets hidden, but its text "Dialog" is shown.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;It gets interesting when you click on the button "101" now shown, as you can see from the code, it should take you back to the page ID p1. But here, two pages were rendered, and the first occurring page div slides out and for a brief instant you can see the second page container, which also slides out.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;If you use the browser code inspector, you will see the data-url attribute being automatically added to all page divs. Since no data-url was specified here, the page ID is copied as is. In this case, both data-urls are the same. You can try the above example with different page IDs but having the same data-url and the resultant output is the same.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div data-role="page" id="p2" &lt;/span&gt;&lt;u style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: red;"&gt;&lt;b&gt;data-url="durl1"&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;......&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div data-role="page" id="p3"&amp;nbsp;&lt;/span&gt;
&lt;u style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="color: red;"&gt;&lt;b&gt;data-url="durl1"&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;One final scenario, suppose if the page IDs are duplicated but each page has a different data-url specified.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div data-role="page" &lt;u&gt;&lt;b&gt;&lt;span style="color: red;"&gt;id="p2"&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;data-url="durl1"&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;......&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div data-role="page"&amp;nbsp;&lt;/span&gt;
&lt;u style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span style="color: red;"&gt;id="p2"&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;data-url="durl2"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;And now try to navigate to any page using the data-url.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;a href="#durl1" data-role="button"&amp;gt;Open Page 1&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;a href="#durl2" data-role="button"&amp;gt;Open Page 2&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Bingo! Both links work just works fine.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;So jQuery Mobile primarily uses data-url for page navigation and as long as they are unique, navigation works just fine. And it was a purely accidental discovery that having duplicate data-urls messes up the rendered content.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Now is this a valid bug? I feel the framework should gracefully handle this and render only the first instance of matching data-url. The behavior would then be consistent with how various browser engines handle duplicate IDs (from my previous post). But again is this an overkill? Should the framework focus on adding more features that work correctly on multiple devices/platforms/browsers or fix such scenarios. That is a call that the jQuery Mobile developer community has to take.&lt;/span&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/IevxoTGzdjg" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/O8CAyGm_5r4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/1601948749124698009/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/jquery-mobile-and-duplicated-page-ids.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/1601948749124698009?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/1601948749124698009?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/O8CAyGm_5r4/jquery-mobile-and-duplicated-page-ids.html" title="jQuery Mobile and Duplicated Page IDs" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/jquery-mobile-and-duplicated-page-ids.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/IevxoTGzdjg/jquery-mobile-and-duplicated-page-ids.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcAQHo6fSp7ImA9WhRaGE4.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-54096731285190761</id><published>2011-12-22T01:53:00.002+05:30</published><updated>2012-02-21T20:57:21.415+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-21T20:57:21.415+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="spec" /><category scheme="http://www.blogger.com/atom/ns#" term="graceful degradation" /><category scheme="http://www.blogger.com/atom/ns#" term="unique id" /><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="navigation" /><category scheme="http://www.blogger.com/atom/ns#" term="css" /><title>Using duplicate IDs in HTML</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Well today I'm being a bit controversial. Let us see what the &lt;a href="http://www.w3.org/TR/html5/elements.html#concept-id" target="_blank"&gt;HTML5 spec&lt;/a&gt; says about unique IDs in a HTML file.&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: left;"&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="background-color: white; text-align: -webkit-auto;"&gt;The&amp;nbsp;&lt;/span&gt;&lt;code style="background-color: white; color: orangered; font-size: inherit; text-align: -webkit-auto;" title="attr-id"&gt;&lt;a href="http://www.w3.org/TR/html5/elements.html#the-id-attribute" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial;"&gt;id&lt;/a&gt;&lt;/code&gt;&lt;span style="background-color: white; text-align: -webkit-auto;"&gt;&amp;nbsp;attribute specifies its element's&amp;nbsp;&lt;/span&gt;&lt;dfn id="concept-id" style="background-color: white; font-style: normal; font-weight: bold; text-align: -webkit-auto;" title="concept-id"&gt;unique identifier (ID)&lt;/dfn&gt;&lt;span style="background-color: white; text-align: -webkit-auto;"&gt;. The value must be unique amongst all the IDs in the element's&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.w3.org/TR/html5/infrastructure.html#home-subtree" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; color: #660099; text-align: -webkit-auto;"&gt;home subtree&lt;/a&gt;&lt;span style="background-color: white; text-align: -webkit-auto;"&gt;&amp;nbsp;and must contain at least one character. The value must not contain any&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.w3.org/TR/html5/common-microsyntaxes.html#space-character" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; color: #660099; text-align: -webkit-auto;" title="space character"&gt;space characters&lt;/a&gt;&lt;span style="background-color: white; text-align: -webkit-auto;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="note" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: green; font-style: italic; margin-bottom: 1em; margin-top: 1em; padding-bottom: 0.5em; padding-left: 2em; padding-right: 2em; padding-top: 0.5em; text-align: -webkit-auto;"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;An element's&amp;nbsp;&lt;a href="http://www.w3.org/TR/html5/elements.html#concept-id" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; color: #660099;" title="concept-id"&gt;unique identifier&lt;/a&gt;&amp;nbsp;can be used for a variety of purposes, most notably as a way to link to specific parts of a document using fragment identifiers, as a way to target an element when scripting, and as a way to style a specific element from CSS.&lt;/span&gt;&lt;/div&gt;
Yes its been mentioned almost everywhere on the planet that ID must be unique. Now let us look at the below code,&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;a href="http://dl.dropbox.com/u/53242546/dup-id.html" target="_blank"&gt;&lt;span style="background-color: blue; color: white; font-family: Verdana, sans-serif;"&gt;&lt;span id="goog_1822440228"&gt;&lt;/span&gt;Launch&lt;span id="goog_1822440229"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;dup.css&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;#p2 {&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; background-color: yellow;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;span class="Apple-tab-span" style="font-family: Verdana, sans-serif; white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;dup-id.html&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Duplicate ID Tester&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;link rel="stylesheet" href="dup.css" /&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&amp;lt;a href="#p1"&amp;gt;1&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&amp;lt;a href="#p2"&amp;gt;2&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&amp;lt;a href="#p2"&amp;gt;3&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div id="p1"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;p&amp;gt;ID IS 1&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: red;"&gt;&lt;b&gt;&amp;lt;div &lt;u&gt;id="p2"&lt;/u&gt;&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;p&amp;gt;ID IS 2&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;&lt;b&gt; &lt;span style="color: red;"&gt;&amp;lt;div &lt;u&gt;id="p2"&lt;/u&gt;&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;p&amp;gt;ID IS 3&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;p&amp;gt;Now lets get ID 2 again using javascript&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;document.write(document.getElementById("p2").innerHTML);&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;I've committed a big sin in this HTML code. Yes there are 2 div elements that use the same ID "&lt;b&gt;p2&lt;/b&gt;". What should happen when you render this page now?&amp;nbsp;I have tried this code on the famous five (Chrome, Firefox, IE, Safari and Opera) and also on the Android, Opera Mobile and Firefox Mobile browsers, and they all behave exactly the same way. You will actually see that the three major criteria mentioned in the HTML5 spec, seem to work just fine.&lt;/span&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Linking to a document fragment:&lt;/b&gt;&amp;nbsp;Reduce your browser size and click on link 2, it will navigate to the first div with the ID p2&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Styling:&lt;/b&gt; Both the divs with the ID p2 are styled&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Targeting the element using JavaScript:&lt;/b&gt; You will see that the text (ID IS 2) of the first div with ID p2 is printed using javascript at the end of the html doc.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;To summarize, linking and picking up the first element with matching ID is done and all matching elements are styled.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;But the question is, why do browsers behave this well in spite of the spec mandating the ID to be unique? The answer is that browsers have come away from the strict mode and are more relaxed in the way they handle bad code (even more so now with HTML5). They are quite developer friendly and try to render as much as possible and fail gracefully where possible. Yes, that is the way to go!&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red; font-family: Verdana, sans-serif;"&gt;But still a word of caution, it is not recommended to use duplicate IDs as it is against the spec and the browsers could change their implementation anytime. A hundred different things could go wrong in your code and you will spend hours figuring out what the issue is.&lt;/span&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/guaCHWasDQ8" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/rA6uoo07oIg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/54096731285190761/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/html5-and-duplicated-element-ids.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/54096731285190761?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/54096731285190761?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/rA6uoo07oIg/html5-and-duplicated-element-ids.html" title="Using duplicate IDs in HTML" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/html5-and-duplicated-element-ids.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/guaCHWasDQ8/html5-and-duplicated-element-ids.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEEMQX8zeyp7ImA9WhRaGE4.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-1743480634822665301</id><published>2011-12-19T19:40:00.002+05:30</published><updated>2012-02-21T20:34:40.183+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-21T20:34:40.183+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="performance" /><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="jqm" /><category scheme="http://www.blogger.com/atom/ns#" term="DOM" /><category scheme="http://www.blogger.com/atom/ns#" term="DOM cache" /><category scheme="http://www.blogger.com/atom/ns#" term="data-prefetch" /><category scheme="http://www.blogger.com/atom/ns#" term="data-dom-cache" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><title>jQuery Mobile Page Caching demo</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;In my &lt;/span&gt;&lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-prefetching-pages-demo.html" style="font-family: Verdana, sans-serif;" target="_blank"&gt;previous post&lt;/a&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;, I outlined how to prefetch links to make jQuery mobile app load your pages faster. The ui-loader spinning animation was not shown as you navigate from one page to another.&lt;/span&gt;&lt;br /&gt;
&lt;a href="http://dl.dropbox.com/u/53242546/mainpage.html" style="background-color: blue; color: white; font-family: Verdana, sans-serif; line-height: 18px; text-decoration: none;" target="_blank"&gt;&lt;b&gt;&lt;br class="Apple-interchange-newline" /&gt;Launch&lt;/b&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: white; font-family: Verdana, sans-serif; line-height: 18px;"&gt;- The previous example with prefetch&lt;/span&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #222222; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #222222; font-family: Verdana, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;But, as also mentioned, it has certain limitations,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;If there are more pages, more http requests are sent out and more bandwidth is required to prefetch&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;If a page hasn't been fully prefetched, the ui-loader spinner animation comes up till the page is fully loaded. Try to click fast and you will see&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Once you visit a prefetched page, navigating away from the page will remove the page from DOM. So this is not same as caching the page. The next visit to the page will again need the page to be fetched.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt;So the obvious solution seems to be to cache the frequently visited pages in the DOM. This way, every link doesn't have to be prefetched on every visit to the page. This is easily done in jQuery Mobile by adding the attribute &lt;/span&gt;&lt;b style="color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt;data-dom-cache="true"&lt;/b&gt;&lt;span style="color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt; to the page&amp;nbsp;&lt;/span&gt;&lt;span style="color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt;div&lt;/span&gt;&lt;span style="color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt;&amp;nbsp;container of the page that you want to cache.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;You could also cache a specific page programmatically by using this call&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; pageContainerElement.page({ domCache: true });&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: Verdana, sans-serif;"&gt;
&lt;br class="Apple-interchange-newline" /&gt;&lt;/div&gt;
&lt;span style="color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt;If you want to cache all pages visited,&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;you could turn on DOM caching using the below code (but keep an eye on the DOM size as it could grow very fast)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;$.mobile.page.prototype.options.domCache = true;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;You can now observe how caching works with the code inspector open (CTRL+SHIFT+I) in your browser. As you navigate, the visited page is not removed from the DOM and after the first visit, it remains put! You will remember in the previous post, the page div used to get added to the DOM and then removed on every page visit.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Let us visit the code...&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;a href="http://dl.dropbox.com/u/53242546/mainpage-domcache.html" style="background-color: blue; color: white; font-family: Verdana, sans-serif; line-height: 18px; text-decoration: none;" target="_blank"&gt;&lt;b&gt;Launch&lt;/b&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #222222; font-family: Verdana, sans-serif; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: white; font-family: Verdana, sans-serif; line-height: 18px;"&gt;- Example with prefetch and DOM cache enabled&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #222222; font-family: Verdana, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;mainpage-domcache.html&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Main Page&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;!-- Use only if you want to cache all visited pages --&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;lt;script&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;u&gt;$.mobile.page.prototype.options.domCache = true;&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/script&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div id="page1" data-role="page"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;Header of Main Page&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="secondpage-domcache.html" data-role="button" data-prefetch&amp;gt;Go to Page 2&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;secondpage-domcache.html (to cache single page)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;title&amp;gt;Second Page&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div id="page2" data-role="page" &lt;u&gt;&lt;b&gt;data-dom-cache="true"&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;Header of Page 2&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#" data-role="button" data-rel="back"&amp;gt;Go Back&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br class="Apple-interchange-newline" /&gt;&lt;/div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Here you will see that the spinning loader doesn't show up. The page is already there in the DOM after the first visit! You can click the links fast and see it still works fine. You can exclude the script to cache everything and try this code with multiple pages and see how caching works.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Just as in real life, there is a flip side to everything positive. Here, you have to be careful how big your DOM grows, as pages keep adding to it. You have to code for the clean up of older pages or pages you no longer need in cache. Mobile devices have limited memory and a bloating DOM could cause misery. So take care !&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/C2RMmkZe_uE" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/_kNZhY_EO5Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/1743480634822665301/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/jquery-mobile-page-caching-demo.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/1743480634822665301?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/1743480634822665301?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/_kNZhY_EO5Y/jquery-mobile-page-caching-demo.html" title="jQuery Mobile Page Caching demo" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/jquery-mobile-page-caching-demo.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/C2RMmkZe_uE/jquery-mobile-page-caching-demo.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAERXg-eip7ImA9WhRaGE4.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-5751864055214431364</id><published>2011-12-19T18:28:00.002+05:30</published><updated>2012-02-21T19:45:04.652+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-21T19:45:04.652+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="performance" /><category scheme="http://www.blogger.com/atom/ns#" term="jqm" /><category scheme="http://www.blogger.com/atom/ns#" term="ui-loader" /><category scheme="http://www.blogger.com/atom/ns#" term="mobile app" /><category scheme="http://www.blogger.com/atom/ns#" term="data-prefetch" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><category scheme="http://www.blogger.com/atom/ns#" term="navigation" /><title>jQuery Mobile Prefetching pages demo</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Using a single-page template for your mobile app makes your app faster and lighter. But you have to fetch each page during navigation and you end up seeing the ui-loader spinning icon animation every time. It can get to your nerves.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;a href="http://dl.dropbox.com/u/53242546/mainpage-title.html" style="background-color: blue; color: white; line-height: 18px; text-decoration: none;" target="_blank"&gt;&lt;b&gt;Launch&lt;/b&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="background-color: white; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&amp;nbsp;&lt;/span&gt;- Example without prefetch&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #222222; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #222222; line-height: 18px;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;The above example, from my previous post shows how the spinning icon comes up each time you navigate from the main page to page 2. I will not list the code here as its already listed in an &lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-in.html" target="_blank"&gt;earlier post&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;In a multi-page template whereas, the entire set of pages are already loaded into the DOM and the navigation is much faster. A similar behavior can be obtained in a single-page application by prefetching pages. This is done by just adding the attribute &lt;b&gt;data-prefetch&lt;/b&gt;&amp;nbsp;to all the links that you want to prefetch. As soon as the page loads, it starts fetching these links and loads it into the DOM. You can observe this behavior with the code inspector open (CTRL+SHIFT+I) in your browser. Now navigating to one of these links happens immediately and the spinning loader is no longer shown.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;You could also prefetch a link programmatically by using this JavaScript call&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; $.mobile.loadPage( pageUrl );&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;The below code shows how data-prefetch works. You can launch it in a separate browser tab.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;a href="http://dl.dropbox.com/u/53242546/mainpage.html" style="background-color: blue; color: white; line-height: 18px; text-decoration: none;" target="_blank"&gt;&lt;b&gt;Launch&lt;/b&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #222222; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: white; line-height: 18px;"&gt;- Example with prefetch&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="background-color: white; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;mainpage.html&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Main Page&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div id="page1" data-role="page"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;Header of Main Page&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="secondpage.html" data-role="button" &lt;b&gt;&lt;u&gt;data-prefetch&lt;/u&gt;&lt;/b&gt;&amp;gt;Go to Page 2&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;secondpage.html&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;title&amp;gt;Second Page&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div id="page2" data-role="page"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;Header of Page 2&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#" data-role="button" data-rel="back"&amp;gt;Go Back&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Here you will see that the spinning loader doesn't show up. (Of course you can click very fast and try to load before the prefetch occurs, the loader shows up only then.)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;Great isn't it. But few things you have to take care,&lt;/span&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;If there are more pages, more http requests are sent out and more bandwidth is required to prefetch&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;If a page hasn't been fully prefetched, the ui-loader spinner comes up and the page is shown only after the page is completely fetched&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;This is not same as the browser cache. Once you navigate to a prefetched page, and then navigate to another page, the prefetched page is removed from the DOM.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;So use this judiciously to make your jQuery Mobile app navigation smoother to the user.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;In my &lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-page-caching-demo.html" target="_blank"&gt;next post&lt;/a&gt; I will show how to cache a jQuery Mobile page in DOM and thus avoid the issue of multiple prefetch.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/aMoAfqZccNY" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/SVBlXHCUicA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/5751864055214431364/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/jquery-mobile-prefetching-pages-demo.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/5751864055214431364?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/5751864055214431364?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/SVBlXHCUicA/jquery-mobile-prefetching-pages-demo.html" title="jQuery Mobile Prefetching pages demo" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/jquery-mobile-prefetching-pages-demo.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/aMoAfqZccNY/jquery-mobile-prefetching-pages-demo.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQNSHwzeip7ImA9WhRbFkU.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-7357941734626451143</id><published>2011-12-18T21:18:00.001+05:30</published><updated>2012-02-08T13:19:59.282+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-08T13:19:59.282+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="data-transition" /><category scheme="http://www.blogger.com/atom/ns#" term="jqm" /><category scheme="http://www.blogger.com/atom/ns#" term="data-ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="Ajax transitions" /><category scheme="http://www.blogger.com/atom/ns#" term="ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><title>jQuery Mobile Page Transitions with data-ajax=false</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;In my earlier post &lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-page-transitions-simple.html" target="_blank"&gt;here&lt;/a&gt;, I outlined the various page transitions that are available in jQuery Mobile.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;In single-page template documents,&amp;nbsp;jQM uses Ajax to smoothly transition between pages and when not possible, the framework does a simple HTTP request to pull in the page. Situations where Ajax transitions are not used are:&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;When a page loaded is:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;from an external domain&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;data-ajax="false" attribute is used&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;rel="external" is specified&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;target attribute is specified&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;This is also well &lt;/span&gt;&lt;a href="http://jquerymobile.com/demos/1.0/docs/pages/page-links.html" style="font-family: Verdana, sans-serif;" target="_blank"&gt;documented&lt;/a&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&amp;nbsp;(with examples)&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;In multi-page template documents, jQM needs Ajax to transition between the multiple page containers. Now lets play with this a bit. Let us try to override this with the data-ajax attribute and see what happens.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Consider below code, you can click on the link below to launch it in a separate browser tab:&lt;/span&gt;&lt;br /&gt;
&lt;a href="http://dl.dropbox.com/u/53242546/false-ajax.html" target="_blank"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="background-color: blue; color: white; font-family: Verdana, sans-serif;"&gt;Launch&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;jQuery Mobile Transitions Demo with data-ajax="false"&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div data-role="page" id="page1"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp;&amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page2" data-transition="flip" data-role="button"&amp;gt;data-transition="flip"&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page2" data-transition="flip" data-role="button" data-ajax="false" data-theme="e"&amp;gt;data-transition="flip" data-ajax="false"&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page2" data-rel="dialog" data-role="button"&amp;gt;data-rel="dialog"&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page2" data-rel="dialog" data-role="button" data-transition="pop" data-ajax="false" data-theme="e"&amp;gt;data-rel="dialog" data-ajax="false"&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page3" data-role="button"&amp;gt;data-role="dialog"&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page3" data-role="button" data-ajax="false" data-theme="e"&amp;gt;data-role="dialog" data-ajax="false"&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page3" data-role="button" data-rel="dialog"&amp;gt;data-rel="dialog" data-role="dialog"&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page3" data-role="button" data-rel="dialog" data-ajax="false" data-theme="e"&amp;gt;data-rel="dialog" data-role="dialog" data-ajax="false"&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div data-role="page" id="page2"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;a data-role="button" data-rel="back" data-direction="reverse"&amp;gt;Back&amp;lt;/a&amp;gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div data-role="dialog" id="page3"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;a data-role="button" data-rel="back" data-direction="reverse"&amp;gt;Back&amp;lt;/a&amp;gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;When you launch the above code in a browser, you will note one link works properly followed by another link that doesn't. These links are invoked with data-ajax="false" and highlighted here with a yellow theme. You can also open the code inspector (by CTRL+SHIFT+I) and observe how the DOM behaves as you try out the various scenarios.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The entire behavior of transitions in a multi-page template document with data-ajax="false" is not documented at present (see documentation link given earlier). From the above code you will note the following behavior when data-ajax="false" is specified,&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;DOM is not reloaded everytime since this is a multi-page template document&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Only the default slide transition works, even if you specify any other data-transition (2nd button)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;If a Dialog is launched by data-rel="dialog", again only slide transition works (not the default pop), even if you specify data-transition="pop" (4th button)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;If a Dialog is launched using data-role="dialog", then the transition used is "pop" and any value set in the data-transition attribute is ignored (6th button)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;If a Dialog is launched using data-role="dialog", setting the data-rel="dialog" might not be required (7th button)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;It is not yet clear if the above behavior is as expected and implemented so, and if only the documentation of jQM needs to be updated. Or maybe JQM should ignore data-ajax="false" in a multi-page template scenario. I have now logged a bug against jQuery Mobile and await feedback on the same &lt;a href="https://github.com/jquery/jquery-mobile/issues/3296" target="_blank"&gt;https://github.com/jquery/jquery-mobile/issues/3296&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/8Kh3qLeQ3r4" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/5_nFsTfa4OI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/7357941734626451143/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/jquery-mobile-page-transitions-with.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/7357941734626451143?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/7357941734626451143?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/5_nFsTfa4OI/jquery-mobile-page-transitions-with.html" title="jQuery Mobile Page Transitions with data-ajax=false" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/jquery-mobile-page-transitions-with.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/8Kh3qLeQ3r4/jquery-mobile-page-transitions-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04NRXwzeSp7ImA9WhRaFkk.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-6318682777110986103</id><published>2011-12-16T10:29:00.000+05:30</published><updated>2012-02-19T16:43:14.281+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-19T16:43:14.281+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="firefox" /><category scheme="http://www.blogger.com/atom/ns#" term="developer tools" /><category scheme="http://www.blogger.com/atom/ns#" term="strict" /><category scheme="http://www.blogger.com/atom/ns#" term="semantics" /><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="code inspector" /><category scheme="http://www.blogger.com/atom/ns#" term="chrome" /><title>Minimal required code in HTML5</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;I've encountered this question repeatedly of late.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;"What are the tags required at bare minimum for a html file?"&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Earlier there were a bunch of mandatory tags that were required for any html file. At bare minimum, the recommended structure was: (ref: &lt;a href="http://www.w3.org/TR/html4/struct/global.html"&gt;http://www.w3.org/TR/html4/struct/global.html&lt;/a&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;HTML&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;HEAD&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;TITLE&amp;gt;A small HTML&amp;lt;/TITLE&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/HEAD&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;BODY&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;P&amp;gt;Small HTML file!&amp;lt;/P&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/BODY&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/HTML&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Yes, using capitals for the tags was the way to go! Those were the days of the purists and strict was the way to be. Now open your notepad and copy the above code, save the file as old.html and launch it in Chrome or Firefox. You will see only one line "Small HTML file!" shown. Now launch the developer tools in Chrome or Inspect Element in Firefox. This can be done by pressing CTRL+SHIFT+I in both the browsers. You will see the html code rendered by the browser now shown in the inspector. The code matches with the above code.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Now lets look at how things stand today. Welcome HTML5!&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;Smallest HTML file!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Type the above code in notepad and save it as new.html. Yes just two lines, actually the first line is recommended for HTML5, but for basic stuff even that is not necessary. You can even skip that line for this particular exercise. Now save and open the file in your browser. Voila, the text is there, now open the code inspector. You will see the missing tags have been automatically added by the browser. This is what the code inspector should show:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;body&amp;gt;Smallest&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;HTML&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;file!&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Great isn't it. Things have been vastly simplified and made easier for the developer. DOCTYPE's earlier used to cause allergic reactions in me. Now it requires just one word "html".&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;There is one more thing that I wish to highlight. I see so many HTML5 pages still showing this code while using JavaScript,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;SCRIPT &lt;span style="color: red;"&gt;type="text/javascript"&lt;/span&gt; src="...."&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;This can simply be&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&amp;lt;script src="...."&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;There is no need to specify the type attribute. JavaScript is the default. And yes please use small case where possible. Easier on the eyes and the brain!&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;There are many more wonderful simplifications done in the HTML5 semantics. And there are entire chapters dedicated to this topic in various HTML5 books.&amp;nbsp;But somehow, I keep encountering the above quite often off late and so the post.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/rR0gENZAD5o" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/c3Rvg1l7nRY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/6318682777110986103/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/minimal-required-code-in-html5.html#comment-form" title="19 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6318682777110986103?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6318682777110986103?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/c3Rvg1l7nRY/minimal-required-code-in-html5.html" title="Minimal required code in HTML5" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>19</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/minimal-required-code-in-html5.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/rR0gENZAD5o/minimal-required-code-in-html5.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMEQ3o8fip7ImA9WhRaF04.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-2500374238075250601</id><published>2011-12-15T17:16:00.000+05:30</published><updated>2012-02-20T15:36:42.476+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-20T15:36:42.476+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="comparison" /><category scheme="http://www.blogger.com/atom/ns#" term="title" /><category scheme="http://www.blogger.com/atom/ns#" term="multi-page template" /><category scheme="http://www.blogger.com/atom/ns#" term="jqm" /><category scheme="http://www.blogger.com/atom/ns#" term="transition" /><category scheme="http://www.blogger.com/atom/ns#" term="single-page template" /><category scheme="http://www.blogger.com/atom/ns#" term="data-ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><category scheme="http://www.blogger.com/atom/ns#" term="data-role" /><title>jQuery Mobile single-page vs multi-page template</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;[Updated 2012/02/09]&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;In my recent posts I mentioned about jQuery Mobile single-page and multi-page templates, so what exactly are the differences between them?&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Single Page Template:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;a href="http://dl.dropbox.com/u/53242546/mainpage-title.html" style="background-color: blue; color: white;" target="_blank"&gt;Launch&lt;/a&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&amp;nbsp;&lt;/span&gt;- example from previous post, notice the address shown as you navigate&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Lighter and cleaner. Each page is a separate html file and more modular.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Better fallback if JavaScript is not supported. So works well on more platforms, you could even target &lt;a href="http://jquerymobile.com/gbs/" target="_blank"&gt;grade C&lt;/a&gt; browsers&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;On first load, the start page is loaded into the DOM. An internal reference is always held to this. Any new page loaded is added to the DOM. Any previously shown page is removed from the DOM. The start page is always in the DOM.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;The DOM size is relatively smaller&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Optional to use the "page" data-role element in the code&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Can turn off Ajax Navigation between pages using data-ajax="false"&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Recommend to use the &amp;lt;title&amp;gt; tag for page titles&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;The &amp;lt;title&amp;gt; tag always gets precedence during page loads&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Consumes more bandwidth as each page navigation generates a new request&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Navigating back to a previously loaded page will again generate a fresh request (with &lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-page-caching-demo.html" target="_blank"&gt;DOM caching&lt;/a&gt; you can avoid reloading of the same pages multiple times)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;First load is faster, but every subsequent page has to be fetched&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Suitable for larger applications and situations where you want to target as many platforms as possible including platforms which lack JavaScript support&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Multi Page Template:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;a href="http://dl.dropbox.com/u/53242546/data-title.html" style="background-color: blue; color: white;" target="_blank"&gt;Launch&lt;/a&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;&amp;nbsp;- example from previous post,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; font-family: Verdana, sans-serif;"&gt;notice the address shown as you navigate&lt;/span&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Heavier. All the pages are in a single html file.&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Needs JavaScript support as Ajax Navigation is used&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Multiple page containers are present, and only the first one is shown when page loads&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Large applications with many pages will increase the DOM size&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;The "page" data-role element is required&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Using data-ajax="false" for internal pages ignores the data-transition attribute, by default slide is used&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Recommend to use the data-title attribute for all page titles&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;On first load, &amp;lt;title&amp;gt; tag is used and subsequent transitions data-title is used for page titles&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Since all pages are already loaded, no additional requests are generated for navigating between pages&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;First load is slower as the file size is larger, but subsequent page navigation is fast&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Suitable for relatively smaller applications and situations where you know the capabilities of your target platforms including presence of JavaScript support&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/KRhQL2OzttE" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/VmZYyTObnv8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/2500374238075250601/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/jquery-mobile-single-page-vs-multi-page.html#comment-form" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/2500374238075250601?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/2500374238075250601?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/VmZYyTObnv8/jquery-mobile-single-page-vs-multi-page.html" title="jQuery Mobile single-page vs multi-page template" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>10</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/jquery-mobile-single-page-vs-multi-page.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/KRhQL2OzttE/jquery-mobile-single-page-vs-multi-page.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MBRng5eyp7ImA9WhRXFEQ.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-6006431512019011309</id><published>2011-12-15T15:33:00.001+05:30</published><updated>2011-12-21T23:47:37.623+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-21T23:47:37.623+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="recommendations" /><category scheme="http://www.blogger.com/atom/ns#" term="best practices" /><category scheme="http://www.blogger.com/atom/ns#" term="multi-page template" /><category scheme="http://www.blogger.com/atom/ns#" term="jqm" /><category scheme="http://www.blogger.com/atom/ns#" term="single-page template" /><category scheme="http://www.blogger.com/atom/ns#" term="page title" /><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="header" /><category scheme="http://www.blogger.com/atom/ns#" term="data-title" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><title>jQuery Mobile Recommendations for Page Title</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;In my previous two posts, I outlined how page titles are picked up in jQuery Mobile in a single-page and in a multi-page template scenario.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Read them here:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-with.html" target="_blank"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;jQuery Mobile data-title behavior with multi-page template&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-in.html" target="_blank"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;jQuery Mobile data-title behavior in single-page template&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Though its a very trivial thing, it is important that the right titles are shown on your pages as you navigate through your mobile&amp;nbsp;HTML5&amp;nbsp;app.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;So we see that there are 3 options available to set the page title,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The &amp;lt;title&amp;gt; tag&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The data-title attribute of the page container&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The header text in the header container&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Now the question is which one to use?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;And here are my recommendations,&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;For the landing page for any app, use the &amp;lt;title&amp;gt; tag, that always is the primary one to use. The document.title gets populated first and use the same.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;For multi-page template, use data-title for every page container, including the first container in the document. After first load, every subsequent Ajax transition uses this attribute.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;For single-page template, do not use the data-title attribute, every individual html page will have its own &amp;lt;title&amp;gt; tag and let that take precedence by default. Lack of JavaScript support, or not using Ajax transitions (via data-ajax="false"), will still show the correct title from the &amp;lt;title&amp;gt; tag.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The header container (data-role="header") text should better be used for the page header and not the title. No point in having the same title and header, its plain non-intuitive!&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div&gt;
So what do you think?&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/zH2KHd3ibQk" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/suiPWmiDcIQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/6006431512019011309/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/in-my-previous-two-posts-i-outlined-how.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6006431512019011309?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6006431512019011309?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/suiPWmiDcIQ/in-my-previous-two-posts-i-outlined-how.html" title="jQuery Mobile Recommendations for Page Title" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/in-my-previous-two-posts-i-outlined-how.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/zH2KHd3ibQk/in-my-previous-two-posts-i-outlined-how.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8CQHk4fCp7ImA9WhRbFkU.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-1873853970348065337</id><published>2011-12-15T14:05:00.001+05:30</published><updated>2012-02-08T13:27:41.734+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-08T13:27:41.734+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="recommendations" /><category scheme="http://www.blogger.com/atom/ns#" term="best practices" /><category scheme="http://www.blogger.com/atom/ns#" term="multi-page template" /><category scheme="http://www.blogger.com/atom/ns#" term="jqm" /><category scheme="http://www.blogger.com/atom/ns#" term="single-page template" /><category scheme="http://www.blogger.com/atom/ns#" term="page title" /><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="header" /><category scheme="http://www.blogger.com/atom/ns#" term="data-title" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><title>jQuery Mobile data-title behavior in single-page template</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;In my &lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-with.html" target="_blank"&gt;previous post&lt;/a&gt;, I had visited the behavior of the jQuery Mobile library data-title attribute under different scenarios when using a multi-page template.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;In this post, I will outline the behavior when using a single-page template.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="post-body entry-content" id="post-body-3673117259535639627"&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Consider the below single-page template code.&amp;nbsp;Click here to launch the below code in a separate browser.&lt;/span&gt;&lt;/div&gt;
&lt;a href="http://dl.dropbox.com/u/53242546/mainpage-title.html" style="background-color: blue;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: white; font-family: Verdana, sans-serif;"&gt;Launch&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;mainpage-title.html&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Main Page&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;div style="font-family: 'Times New Roman';"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;div id="page1" data-role="page" data-title="Mainpage data-title"&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;Header of Main Page&amp;lt;/h1&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="secondpage-title.html" data-role="button"&amp;gt;Go to Page 2&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;secondpage-title.html&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;title&amp;gt;Second Page&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div id="page2" data-role="page" data-title="Page 2 data-title"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;h1&amp;gt;Header of Page 2&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&amp;lt;a data-role="button" data-rel="back"&amp;gt;Go Back&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;
This is a working example. Play with it to see how the page transitions occur. Now lets go through the similar scenarios as in previous article:&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;When you first load this html, main page is displayed, you will first 
see the title as "Main Page". The &amp;lt;title&amp;gt; tag (document.title) 
always gets precedence.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;If the &amp;lt;title&amp;gt; tag is not present, you will get the address of the page shown as the title.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Now click on the "Go to Page 2" button, you will slide into page 2 
and the title is shown as "Page 2 data-title", you will see this is a minimal html file. HTML5 makes semantics much more simpler. Browser knows what to do. Again here, since Ajax transition was used, the data-title is picked up and not the document.title which was "Second Page".&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;From page 2, click on the "Go Back" button, now main page will 
open and the title is shown as "Main Page", itself and not the data-title text. This is different from multi-page template behavior. Now why did that happen? The reason here is, when Main page was first loaded, document.title gets populated, which gets precedence and is used. Now every visit to this page uses the same document.title value instead of what is there in data-title attribute. But since page 2 (newly loaded) was via Ajax, the data-title gets picked up first and not the &amp;lt;title&amp;gt; tag. This is the way it is implemented.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Now in the code, remove the data-title attribute for page 2, 
navigate to page 2, you will see the title shown as "Second Page", now the &amp;lt;title&amp;gt; is picked up.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;If &amp;lt;title&amp;gt; was missing in page 2, "Header of Page 
2" is displayed, the text from the header.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Now in the code, remove the data-title attribute for main page, 
navigate to main page from page 2, you will see the title again being shown
 from the data-title tag this time. So the title is shown as "Mainpage data-title".&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Now in the code, remove the entire "header" div from page 2, and 
also remove the data-title from page 2, now if you navigate into page 2 
from the main page, then the 
current title of main page is used.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;So when you compare the behavior of page titles from single-page to multi-page templates, the order of precedence is different while picking the title of page 2 from the &amp;lt;title&amp;gt; tag (as outlined in point 4 above).&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/CG4zKWIxdu4" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/Z1p9sHyETHo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/1873853970348065337/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/1873853970348065337?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/1873853970348065337?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/Z1p9sHyETHo/jquery-mobile-data-title-behavior-in.html" title="jQuery Mobile data-title behavior in single-page template" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-in.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/CG4zKWIxdu4/jquery-mobile-data-title-behavior-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cNQH8-fyp7ImA9WhRaFUg.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-8301020449569912049</id><published>2011-12-14T00:55:00.001+05:30</published><updated>2012-02-18T15:28:11.157+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-18T15:28:11.157+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="reverse" /><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="data-transition" /><category scheme="http://www.blogger.com/atom/ns#" term="data-direction" /><category scheme="http://www.blogger.com/atom/ns#" term="page transition" /><category scheme="http://www.blogger.com/atom/ns#" term="data-rel" /><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><title>jQuery Mobile page transitions simple demo</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
jQuery Mobile has amazing Ajax page transitions available by default. This blog post gives a quick example to demonstrate the same.&lt;br /&gt;
&lt;br /&gt;
Click here to launch the below code in a separate browser. &lt;br /&gt;
&lt;a href="http://dl.dropbox.com/u/53242546/transitions.html" style="background-color: blue;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;Launch&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Transitions Demo&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div id="page1" data-role="page"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;Pick your transition&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page2" data-role="button" data-transition="slide"&amp;gt;Slide&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;a href="#page2" data-role="button" data-transition="slideup"&amp;gt;Slideup&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;a href="#page2" data-role="button" data-transition="slidedown"&amp;gt;Slidedown&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;a href="#page2" data-role="button" data-transition="pop"&amp;gt;Pop&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;a href="#page2" data-role="button" data-transition="fade"&amp;gt;Fade&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;a href="#page2" data-role="button" data-transition="flip"&amp;gt;Flip&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div id="page2" data-role="page"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;Reverse the transition now&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"&gt;  &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p&amp;gt;&amp;lt;a href="#" data-role="button" data-rel="back"&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;data-direction="reverse"&amp;gt;Reverse&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So there are 6 page transitions are available by default and the &lt;b&gt;data-transition&lt;/b&gt; attribute specifies the same.&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Slide&lt;/li&gt;
&lt;li&gt;Slideup&lt;/li&gt;
&lt;li&gt;Slidedown&lt;/li&gt;
&lt;li&gt;Pop (best for dialogs)&lt;/li&gt;
&lt;li&gt;Fade&lt;/li&gt;
&lt;li&gt;Flip&lt;/li&gt;
&lt;/ol&gt;
I've also included an option to reverse the most recent page transition and this is done using the &lt;b&gt;data-rel&lt;/b&gt; and &lt;b&gt;data-direction&lt;/b&gt; attribute as shown. As shown in the docs, adding a data-rel="dialog" attribute to the anchor link will open the page as a dialog.&lt;br /&gt;
&lt;br /&gt;
Simple isn't it.&amp;nbsp;Enjoy !!&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/dPd8H1ZGgs0" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/OECz4-WrvhU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/8301020449569912049/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/jquery-mobile-page-transitions-simple.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/8301020449569912049?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/8301020449569912049?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/OECz4-WrvhU/jquery-mobile-page-transitions-simple.html" title="jQuery Mobile page transitions simple demo" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/jquery-mobile-page-transitions-simple.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/dPd8H1ZGgs0/jquery-mobile-page-transitions-simple.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUICQHY7fSp7ImA9WhRbFkU.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-3673117259535639627</id><published>2011-12-13T16:18:00.001+05:30</published><updated>2012-02-08T13:22:41.805+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-08T13:22:41.805+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="Ajax transitions" /><category scheme="http://www.blogger.com/atom/ns#" term="bug" /><category scheme="http://www.blogger.com/atom/ns#" term="data-title" /><category scheme="http://www.blogger.com/atom/ns#" term="page" /><category scheme="http://www.blogger.com/atom/ns#" term="dialog" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile" /><category scheme="http://www.blogger.com/atom/ns#" term="data-role" /><title>jQuery Mobile data-title behavior with multi-page template</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
The jQuery Mobile library comes with wonderful Ajax page transition capabilities. But you have to keep a look on the Page title as you navigate between the various pages and I have tried to document the behavior under different scenarios in this blog.&lt;br /&gt;
&lt;br /&gt;
Consider the below code, click the below link to launch the code in a separate window.&lt;br /&gt;
&lt;a href="http://goo.gl/NkJPj" target="_blank"&gt;&lt;span class="Apple-style-span" style="background-color: blue; color: white;"&gt;&lt;b&gt;Launch&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Main Page&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div id="page1" data-role="page" data-title="page 1 data-title"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;H1 Header of Page 1&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page2" data-role="button"&amp;gt;Go to page 2&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#dialog" data-role="button" data-ajax="false"&amp;gt;Open Dialog&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div id="page2" data-role="page" data-title="page 2 data-title"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;H1 Header of Page 2&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#page1" data-role="button"&amp;gt;Go to page 1&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div id="dialog" data-role="dialog" data-title="dialog data-title"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="header"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h1&amp;gt;H1 Header of Dialog&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div data-role="content"&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;a href="#" data-rel="back" data-role="button"&amp;gt;Back&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
This is a working example. Play with it to see how the page transitions occur. Now lets go through the various scenarios:&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;When you first load this html, page 1 is displayed, you will first see the title as "Main Page". The &amp;lt;title&amp;gt; tag (document.title) always gets precedence.&lt;/li&gt;
&lt;li&gt;If the &amp;lt;title&amp;gt; tag is not present, you will get the address of the page shown as the title.&lt;/li&gt;
&lt;li&gt;Now click on the "Go to page 2" button, you will slide into page 2 and the title is shown as "page 2 data-title", ah so the data-title attribute is now working. So whenever an Ajax transition is used, the data-title is picked.&lt;/li&gt;
&lt;li&gt;From page 2, click on the "Go to page 1" button, now page 1 will open and the title is shown as "page 1 data-title", ignoring the &amp;lt;title&amp;gt; tag even if it is present or not. Again Ajax transition. But not always !!!&lt;/li&gt;
&lt;li&gt;Now in the code, remove the data-title attribute for page 2, navigate to page 2, you will see the title shown as "H1 Header of Page 2". So if the data-title attribute is missing, the text from the header is picked up.&lt;/li&gt;
&lt;li&gt;Now in the code, remove the data-title attribute for page 1, navigate to page 1 from page 2, you will see the title again being shown from the &amp;lt;title&amp;gt; tag, if the &amp;lt;title&amp;gt; tag was not present, then the title is shown as "H1 Header of Page 1".&lt;/li&gt;
&lt;li&gt;Now in the code, remove the entire "header" div from page 2, and also remove the data-title from page 2, now if you navigate into page 2 from page 1, if page 1 had &amp;lt;title&amp;gt; then that text is shown as the page 2 title, if page 1 didn't have the &amp;lt;title&amp;gt; tag, then the current title of page 1 is carried to page 2.&lt;/li&gt;
&lt;/ol&gt;
One could add a data-role="dialog" and view the same sort of behavior with dialogs. Dialogs also support data-title attribute. As per jQuery Mobile docs, even the headers (data-role="header")&amp;nbsp;support the data-title attribute, but for some reason I just couldn't get it to work.&lt;br /&gt;
&lt;br /&gt;
I feel point 6 above and the non working header data-title attributes are bugs in jQuery Mobile 1.0. Have to cross check further and log the same against jQuery Mobile.&lt;br /&gt;
&lt;br /&gt;
5:30pm Updated:&lt;br /&gt;
For point 6 above: It is working as expected and not a bug. The internal implementation of jQuery mobile is that, the multiple pages are loaded and stacked, when a specific page link is clicked, jQuery Mobile gets that specific internal page and transition it into view. Here, page 1 was already available with document.title set to Main Page, so the same was shown in spite of Ajax navigation. If the &amp;lt;title&amp;gt; tag was not present, then the header text is used.&lt;br /&gt;
&lt;br /&gt;
I have now logged a bug against jQuery Mobile for the data-title attribute under the Header:&amp;nbsp;&lt;a href="https://github.com/jquery/jquery-mobile/issues/3259" target="_blank"&gt;https://github.com/jquery/jquery-mobile/issues/3259&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Read the &lt;a href="http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-in.html" target="_blank"&gt;next part&lt;/a&gt; of this post on how these scenarios play out in a single-page template.&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/3Js_YVKpMGU" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/avuXy2BrZI4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/3673117259535639627/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-with.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/3673117259535639627?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/3673117259535639627?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/avuXy2BrZI4/jquery-mobile-data-title-behavior-with.html" title="jQuery Mobile data-title behavior with multi-page template" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/12/jquery-mobile-data-title-behavior-with.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/3Js_YVKpMGU/jquery-mobile-data-title-behavior-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEICQX49eip7ImA9WhVTEkU.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-6279773072857727868</id><published>2011-10-31T15:06:00.002+05:30</published><updated>2012-02-27T01:32:40.062+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-27T01:32:40.062+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="autofocus" /><title>autofocus to multiple controls in HTML5</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The HTML5&amp;nbsp;&lt;a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#attr-fe-autofocus"&gt;spec&lt;/a&gt; says:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span class="Apple-style-span" style="background-color: white; font-family: sans-serif;"&gt;There must not be more than one element in the document with the&amp;nbsp;&lt;/span&gt;&lt;code style="background-color: white; color: orangered; font-size: inherit; text-align: -webkit-auto;" title="attr-fe-autofocus"&gt;&lt;a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#attr-fe-autofocus" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial;"&gt;autofocus&lt;/a&gt;&lt;/code&gt;&lt;span class="Apple-style-span" style="background-color: white; font-family: sans-serif; text-align: -webkit-auto;"&gt;&amp;nbsp;attribute specified.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="background-color: white; font-family: sans-serif; text-align: -webkit-auto;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Excellent, so what happens if you set multiple elements with the autofocus attribute? And in various browsers? Results below ...&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;Autofocus not supported:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;IE9&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;First Element gets the focus:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;IE 10 preview, FF&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;The last element gets the focus:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Chrome, Opera, Safari&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Though its up to the User Agents to implement the behavior, I prefer the Webkit implementation of this feature compared to that of Mozilla and Trident.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Why?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;HTML5 says that browsers should gracefully degrade. They should try to render whatever possible. Not being strict that is. So if a browser stops with the first autofocus, one will never know if there were more than one autofocus elements in the document. But, if the browser renders and sets every autofocus as it parses the document, thus stopping at the last autofocus, the developer will immediately know something is amiss and correct/remove the unwanted autofocus. An added advantage one can thus get with webkit.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/ElmBH4ndG_c" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/3xFwX0Jd2yo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/6279773072857727868/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/10/autofocus-to-multiple-controls-in-html5.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6279773072857727868?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6279773072857727868?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/3xFwX0Jd2yo/autofocus-to-multiple-controls-in-html5.html" title="autofocus to multiple controls in HTML5" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/10/autofocus-to-multiple-controls-in-html5.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/ElmBH4ndG_c/autofocus-to-multiple-controls-in-html5.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QCSH8yeyp7ImA9WhRaFEU.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-1023325566354868556</id><published>2011-07-24T23:03:00.001+05:30</published><updated>2012-02-17T18:59:29.193+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-17T18:59:29.193+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="profile" /><category scheme="http://www.blogger.com/atom/ns#" term="global" /><category scheme="http://www.blogger.com/atom/ns#" term="gravatar" /><category scheme="http://www.blogger.com/atom/ns#" term="patent" /><title>Patent for a single shared profile service</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;I have faced this problem multiple times. And its damn frustrating. Yes, I'm talking about the ten different places my profile is or was on the web. Google, Google apps account, LinkedIn, Twitter, FB and heaven knows where else. Any change in status or the way I want my profile to be worded, I have to remember and go and update all these places. Its a pain in all the wrong places. Trust me.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Then I thought, someone must be providing such a shared profile service. You update your profile just one place and then push it to all these various social networks and web sites. I searched. Found nothing. I searched hard, asked my friends about this. Nothing! Zilch!! There were a few websites, that were almost there, but not exactly what I wanted. &lt;a href="http://en.gravatar.com/"&gt;Gravatar&lt;/a&gt; has this for one's avatar. So why not something for profiles? Nopes.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Then I had an enlightenment! Why not build this service and provide to the users on the web. I had an even better idea, why not patent it. Provide such a wonderful service that I attract users in thousands and maybe sell my startup. Dreams!! Day dreams!! You usually wake up soon :P&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;I searched for a few hours, I finally found that there is already &amp;nbsp;&lt;a href="http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&amp;amp;Sect2=HITOFF&amp;amp;u=%2Fnetahtml%2FPTO%2Fsearch-adv.htm&amp;amp;r=49&amp;amp;f=G&amp;amp;l=50&amp;amp;d=PTXT&amp;amp;p=1&amp;amp;p=1&amp;amp;S1=((((((social+AND+profile)+AND+networks)+AND+single)+AND+unified)+AND+user)+AND+shared)&amp;amp;OS=social+and+profile+and+networks+and+single+and+unified+and+user+and+shared&amp;amp;RS=((((((social+AND+profile)+AND+networks)+AND+single)+AND+unified)+AND+user)+AND+shared)"&gt;patent number 7840690&lt;/a&gt; taken out for this idea. Way back in 2008, by the Go Daddy Inc group. Exactly the same stuff :(&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Damn! Double Damn!&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Well if the US is taken, there are other countries. Why, India doesn't even recognize the concept of a software patent, the concept was squashed way back in 2005! Or maybe the whole concept of patent is not in the spirit of open source. Open Source is good isn't it?&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;So finally, is someone out there who is already building this service? Can they please publish it at the earliest?&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;Anyways, me -- I'm now waiting for the next great idea.&lt;/span&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/as6xSj11IUQ" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/wQPVDS7Ieks" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/1023325566354868556/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/07/patent-for-single-shared-profile-or-not.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/1023325566354868556?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/1023325566354868556?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/wQPVDS7Ieks/patent-for-single-shared-profile-or-not.html" title="Patent for a single shared profile service" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/07/patent-for-single-shared-profile-or-not.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/as6xSj11IUQ/patent-for-single-shared-profile-or-not.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYAR349eyp7ImA9WhdTGEo.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-2406213743877014822</id><published>2011-07-17T09:11:00.001+05:30</published><updated>2011-07-17T09:12:26.063+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-17T09:12:26.063+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="necessitas" /><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="quick" /><category scheme="http://www.blogger.com/atom/ns#" term="qml" /><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="node.js" /><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="Qt" /><category scheme="http://www.blogger.com/atom/ns#" term="flash" /><category scheme="http://www.blogger.com/atom/ns#" term="android" /><title>Developing for Android: HTML5 and Qt</title><content type="html">Recently read a &lt;a href="http://saigeethamn.blogspot.com/2011/06/multiple-ways-of-programming-for.html"&gt;post&lt;/a&gt; by my friend and ex-collegue Sai Geetha on her very famous &lt;a href="http://saigeethamn.blogspot.com/"&gt;Android blog&lt;/a&gt;. I am now reading her blog to start learning a bit about Android development. In her most recent post, she has listed 4 ways for developing in Android.&lt;br /&gt;
&lt;br /&gt;
1. Using the Software Development Kit (SDK) with Java&lt;br /&gt;
2. Native Development Kit using C / C ++. &lt;br /&gt;
3. RenderScript using C99 - used to write faster graphics code like the Google Books page turn animation etc.&lt;br /&gt;
4. Android Scripting Layer using Python etc.&lt;br /&gt;
&lt;br /&gt;
Just thought I'll extend the above further and add a couple of thoughts to this list...&lt;br /&gt;
&lt;br /&gt;
The trend now and what is gaining a lot of traction is developing cross platform apps. So you develop once and can deploy it on multiple platforms. Java showed this promise earlier, but is slowly making way for the newer and greater things out there. One should see how the recently released Java7 will perform. And Java is still the greatest thing for Android development today. Java is also the recommended way of development for S40, the most popular set of Nokia devices. But is the spectrum changing?&lt;br /&gt;
&lt;br /&gt;
Extending point 2 listed by Sai Geetha above, I would also like to draw the reader's attention to the &lt;a href="http://qt.nokia.com"&gt;Qt framework&lt;/a&gt; developed by Nokia (which acquired Trolltech). Qt is a very easy to use cross platform development framework on C++. You basically write your apps once and can compile it to multiple platforms. Already well supported on desktops (Windows, Linux, Mac), mobiles (Symbian, MeeGo) and embedded Linux platforms. &lt;br /&gt;
&lt;br /&gt;
Now the Qt community has also come up with &lt;a href="http://sourceforge.net/p/necessitas/home/necessitas/"&gt;Necessitas&lt;/a&gt;, the Android port of Qt. One just needs to Google on this topic and you'll see quite a bit already out there, and many great demos too. So imagine, you develop your apps with Qt and can target both Android and Symbian/MeeGo devices at the same time. Thats a huge number!&lt;br /&gt;
&lt;br /&gt;
But Qt is not being supported on Nokia's new primary platform, the Windows phone. Would the community take this up too? Who can stop the community?&lt;br /&gt;
&lt;br /&gt;
Extending her point 4 above, Nokia has has introduced Qt Quick (QML), a scripting layer on top of the Qt framework. Quick brings in very fluid and eye catching UX to Qt apps. Most of the logic would be written using JavaScript. Very rarely would developers have to tweak the underlying C++ components. At least that is the goal. So how well QML does on top of Android is something to look forward too.&lt;br /&gt;
&lt;br /&gt;
In addition to the 4 ways listed above, there is a 5th way, which I think will supercede all the other ways eventually (at least for most of the use cases), and that is developing apps using HTML5, CSS and JS. So you write code once and thats it, it will work everywhere and no recompilation required too. HTML5 widgets are catching on very fast, and its no longer just restricted for web development! So with HTML5, its no plugins, no additional layers, but just pure JavaScript. One would revert to native code rarely, where absolutely no support is available with HTML5. This "not supported" list is shrinking by the day. Today people are writing very fast web servers like Node.js using JS, and one can only wait for how the whole thing will play out. I for one, am betting big time on this 5th horse. &lt;br /&gt;
&lt;br /&gt;
It was Steve Jobs who set the ball rolling with his no Flash support in his famous &lt;a href="http://www.apple.com/hotnews/thoughts-on-flash/"&gt;open letter&lt;/a&gt;. Soon everyone was on board. Now with the recently announced Windows 8 platform, Microsoft too has jumped on the HTML5 bandwagon. HTML5 would be their primary development platform (with of course "backward compatibility" with Silverlight, .Net etc etc frameworks) :D I just love Adobe, they are totally into authoring tools and not married to anything, including flash. I'm seeing a lot of HTML5 authoring capabilities in their upcoming tools. &lt;br /&gt;
&lt;br /&gt;
HTML5 still has a long way to go, many quirks to be sorted out. But to conclude, you would need to write code once with HTML5 technologies and you can target all desktop and all mobile platforms out there. Great! Just great! &lt;br /&gt;
&lt;br /&gt;
So what do you think? Do you know of more ways doing Android development? Most importantly, have you started looking at HTML5 technologies?&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/tBHvIgmunD0" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/GVUafE9FWag" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/2406213743877014822/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/07/html5-and-qt-for-developing-for-android.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/2406213743877014822?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/2406213743877014822?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/GVUafE9FWag/html5-and-qt-for-developing-for-android.html" title="Developing for Android: HTML5 and Qt" /><author><name>Chetan Jain</name><uri>https://plus.google.com/117489352085552887358</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-_fb1hq0BI-Q/AAAAAAAAAAI/AAAAAAAAMR8/9PSggTPzLPk/s512-c/photo.jpg" /></author><thr:total>9</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/07/html5-and-qt-for-developing-for-android.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/tBHvIgmunD0/html5-and-qt-for-developing-for-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMHQHs9fSp7ImA9WhdTGU8.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-125336222717852726</id><published>2011-07-15T08:53:00.001+05:30</published><updated>2011-07-17T22:53:51.565+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-17T22:53:51.565+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blog" /><category scheme="http://www.blogger.com/atom/ns#" term="stats" /><category scheme="http://www.blogger.com/atom/ns#" term="browser share" /><category scheme="http://www.blogger.com/atom/ns#" term="chrome" /><title>Pageviews: FF vs Chrome vs IE</title><content type="html">&lt;a href="http://blog.chetankjain.net"&gt;http://blog.chetankjain.net&lt;/a&gt; is a new blog and so the page visits are gradually picking up. Recently crossed a 1000 page views and Google stats throws up a nice picture on how the platform and browser split amongst the audience is. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-3JSVKpBAF5g/Th-xocwYW_I/AAAAAAAAAS0/83j0J8HYSPA/s1600/1000stats.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/-3JSVKpBAF5g/Th-xocwYW_I/AAAAAAAAAS0/83j0J8HYSPA/s400/1000stats.jpg" width="305" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Overall the ratio generally follows the current market trends. I've been following the trend regularly on my site and not surprising to see how Chrome is raising almost every week.&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/dhAjNiGK-Rs" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/lPoGuE4sS5c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/125336222717852726/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/07/pageviews-ff-vs-chrome-vs-ie.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/125336222717852726?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/125336222717852726?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/lPoGuE4sS5c/pageviews-ff-vs-chrome-vs-ie.html" title="Pageviews: FF vs Chrome vs IE" /><author><name>Chetan K Jain</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-AV2iPh2rPCw/TeEK4olzBTI/AAAAAAAAAGw/Y6ykz9Ob1QY/s220/tanu.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-3JSVKpBAF5g/Th-xocwYW_I/AAAAAAAAAS0/83j0J8HYSPA/s72-c/1000stats.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/07/pageviews-ff-vs-chrome-vs-ie.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/dhAjNiGK-Rs/pageviews-ff-vs-chrome-vs-ie.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYMQHYzfCp7ImA9WhdTFUU.&quot;"><id>tag:blogger.com,1999:blog-7670617178132565949.post-6604408403717250601</id><published>2011-07-01T10:17:00.002+05:30</published><updated>2011-07-14T01:46:21.884+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-14T01:46:21.884+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="function" /><category scheme="http://www.blogger.com/atom/ns#" term="self invoking" /><category scheme="http://www.blogger.com/atom/ns#" term="solution" /><category scheme="http://www.blogger.com/atom/ns#" term="books" /><category scheme="http://www.blogger.com/atom/ns#" term="eval" /><title>Solutions: Object Oriented JavaScript: 3. Functions</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Previous: &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://dev.chetankjain.net/2011/06/solutions-object-oriented-javascript.html"&gt;Chapter 2: Primitives &lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit;"&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;Chapter 3: Functions&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;1. Write a function that converts a hexadecimal color, for example blue "#0000FF", into its RGB representation "rgb(0,0,255)". Name your function getRGB() and this it with this code:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; var a = getRGB("#00FF00");&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; a;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; rgb(0,255,0)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; //Simple logic for getRgb() &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; var getRGB = function f(hexColor) {&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var result = "rgb(";&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result += parseInt("0x"+hexColor[1]+hexColor[2]) + ", ";&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result += parseInt("0x"+hexColor[3]+hexColor[4]) + ", ";&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result += parseInt("0x"+hexColor[5]+hexColor[6]) + ")";&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return result;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; &amp;gt;&amp;gt; getRGB("#0000FF");&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&amp;nbsp; "rgb(0, 0, 255)"&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; &amp;gt;&amp;gt; getRGB("#00FF00");&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; "rgb(0, 255, 0)"&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: inherit;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;2. What does each of these lines print in the console?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; parseInt(1e1)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;10&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/b&gt;//1e1 is evaluated first&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; parseInt('1e1')&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;1&amp;nbsp;&amp;nbsp;&lt;/b&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; parseFloat('1e1')&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;10&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/b&gt;//parseFloat evaluates exponential in string&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; isFinitie(0/10)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;true&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; isFinite(20/0)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;false&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; isNaN(parseInt(NaN));&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;true&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;3. What does the following code alert()?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; &amp;gt;&amp;gt; var a = 1;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; function f() {&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var a = 2;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function n() {&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(a);&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; n();&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; f();&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit;"&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // It alerts 2. alert(a) has first access to the local variable a in f() which is defined as 2.&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;4. All these examples alert "Boo!". Can you explain why?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;4.1&amp;nbsp; var f = alert;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval('f("Boo!")');&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;f is assigned the function alert and eval executes the script in string by passing 'Boo!' as parameter.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;4.2&amp;nbsp; var e;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var f = alert;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval('e=f')('Boo!");&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;f is assigned the function alert and eval further assigns alert to e and executes the script in string by passing 'Boo!' as parameter.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;4.3&amp;nbsp; (&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function() {&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return alert;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )() ('Boo!');&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;function() is a self invoking anonymous function that returns the method alert which is executed immediately by passing 'Boo!' as parameter.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Next: 4. Objects&lt;/b&gt; coming soon ...&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;&lt;i style="font-family: inherit;"&gt; &lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/chetankjain/JlKt/~4/i2v4tw1fD7M" height="1" width="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/TheChetankjainDevBlog/~4/Vf_FuCPTKow" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://dev.chetankjain.net/feeds/6604408403717250601/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dev.chetankjain.net/2011/06/solutions-object-oriented-javascript-3.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6604408403717250601?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7670617178132565949/posts/default/6604408403717250601?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheChetankjainDevBlog/~3/Vf_FuCPTKow/solutions-object-oriented-javascript-3.html" title="Solutions: Object Oriented JavaScript: 3. Functions" /><author><name>Chetan K Jain</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-AV2iPh2rPCw/TeEK4olzBTI/AAAAAAAAAGw/Y6ykz9Ob1QY/s220/tanu.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://dev.chetankjain.net/2011/06/solutions-object-oriented-javascript-3.html</feedburner:origLink><feedburner:origLink>http://feedproxy.google.com/~r/chetankjain/JlKt/~3/i2v4tw1fD7M/solutions-object-oriented-javascript-3.html</feedburner:origLink></entry></feed>
