<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kaizou &#187; HTML</title>
	<atom:link href="http://www.kaizou.org/category/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kaizou.org</link>
	<description>This is Web 2.71828</description>
	<lastBuildDate>Thu, 24 Nov 2011 09:34:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Centering a fixed-size element using CSS</title>
		<link>http://www.kaizou.org/2011/11/centering-a-fixed-size-element-using-css/</link>
		<comments>http://www.kaizou.org/2011/11/centering-a-fixed-size-element-using-css/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 09:33:03 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=592</guid>
		<description><![CDATA[This blog post summarizes several options you have to vertically center a div using CSS. The option 4 applies in particular to elements whose height is known: in a nutshell, you ask the browser to stick an element of a specified height to the borders of a bigger containing box, which leads to an automatic [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.themeforest.net/tutorials/vertical-centering-with-css/">This blog post</a> summarizes several options you have to vertically center a div using CSS.<br />
The option 4 applies in particular to elements whose height is known: in a nutshell, you ask the browser to stick an element of a specified height to the borders of a bigger containing box, which leads to an automatic adjustment of the container inner margins.<br />
<code>.centered {<br />
position: absolute;<br />
margin: auto;<br />
top: 0px;<br />
bottom: 0px;<br />
left: 0px;<br />
right: 0px;<br />
}</p>
<p>#red {<br />
background-color: red;<br />
}</p>
<p>#blue {<br />
background-color: blue;<br />
width:25%;<br />
height: 25%;<br />
}</p>
<p>&lt;div id="red" class="centered"&gt;&lt;/div&gt;<br />
&lt;div id="blue" class="centered"&gt;&lt;/div&gt;</code></p>
<style>.container {
position:relative;
width: 200px;
height: 200px;
border: 1px solid black;
}.centered {
position: absolute;
margin: auto;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
}#blue {
background-color: blue;
width:25%;
height: 25%;
}#red {
background-color: red;
}
</style>
<div style="-webkit-column-count:2">
<div class="container">
<div id="red" class="centered"></div>
</div>
<div class="container">
<div id="blue" class="centered"></div>
</div>
</div>
<p>As you can see, the red div stretches to stick to the containing div borders, but the blue div keeps its dimensions and is centered.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/11/centering-a-fixed-size-element-using-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pure CSS 3D Carousel</title>
		<link>http://www.kaizou.org/2011/08/pure-css-3d-carousel/</link>
		<comments>http://www.kaizou.org/2011/08/pure-css-3d-carousel/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 14:46:46 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Carousel 3D CSS3]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=567</guid>
		<description><![CDATA[Yet another example of carousel using this time the CSS 3D Transformations. Only works on WebKit-based browsers (like Chrome or Safari). On devices where you can&#8217;t swipe left and right, use the keyboard left and right arrow to animate. Click on the image to see the live version.]]></description>
			<content:encoded><![CDATA[<p>Yet another example of carousel using this time the CSS 3D Transformations. Only works on WebKit-based browsers (like Chrome or Safari).<br />
On devices where you can&#8217;t swipe left and right, use the keyboard left and right arrow to animate.<br />
<a href="/code/3dcarousel"><img src="/code/3dcarousel/3dcarousel.jpg"></a><br />
Click on the image to see the live version.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/08/pure-css-3d-carousel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Effectively measuring browser framerate using CSS</title>
		<link>http://www.kaizou.org/2011/06/effectively-measuring-browser-framerate-using-css/</link>
		<comments>http://www.kaizou.org/2011/06/effectively-measuring-browser-framerate-using-css/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 12:02:24 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[css 3]]></category>
		<category><![CDATA[fps]]></category>
		<category><![CDATA[framerate]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=540</guid>
		<description><![CDATA[Most browsers now provides features allowing the web developers to design animated user interfaces that were before only available through proprietary plugins such as Flash or Silverlight. Namely, CSS 3 transformations, transitions and animations, HTML 5 canvas or WebGL are the new kids on the block (for those wondering: yes, I was a teen in [...]]]></description>
			<content:encoded><![CDATA[<p>Most browsers now provides features allowing the web developers to design animated user interfaces that were before only available through proprietary plugins such as Flash or Silverlight.</p>
<p>Namely, CSS 3 transformations, transitions and animations, HTML 5 canvas or WebGL are the new kids on the block (for those wondering: yes, I was a teen in the 80s), and have received a lot of attention since a certain mr jobs claimed that no flash plugin would ever make it to his products.</p>
<p>So: what happens when a browser feature becomes widely implemented and popular ? Competition between implementations, of course !</p>
<p>The trouble is that it may be relatively easy to evaluate javascript performance (although one may argue that event javascript benchmarks are biased), but it is a bit more complicated to evaluate actual browser framerate.</p>
<h2>How browser rendering is implemented</h2>
<p>Typically, and although they may use background processes to perform specific asynchronous tasks (such as resource downloads for instance), web browsers do render each web page in a single thread, splitting the CPU time between javascript and rendering tasks. </p>
<p>Typically, on every frame, the browser executes some javascript functions piled in a javascript code queue (with a priority given on timed functions) for a given amount of time (typically 50ms), and then checks whether the page needs to be refreshed or not. If the page needs to be refreshed (either because, the DOM itself has been modified or because a new CSS rule modifies the layout, or for many other reasons &#8230;), it calculates the new page layout, isolates the portion of the page that it needs to refresh (sometimes called the &#8220;damaged&#8221; or &#8220;dirty&#8221; region), and renders it to its &#8220;backing store&#8221; (typically an internal buffer where all the drawing stuff occurs). Once done, it pushes the modified frame on screen using whatever mechanism the host operating system provides. </p>
<p>The important thing to note here is that ultimately, the operating system video drivers decide when the frame is actually pushed to screen: this means that trying to achieve a framerate that exceeds the video output synchronisation rate (typically 60Hz) is useless. As a matter fo fact, most browsers have a &#8220;framerate cap&#8221; hard-coded somewhere to avoid unecessary rendering operations (Chrome provides an option to remove this cap in about:flags).</p>
<h2>Why javascript alone can&#8217;t be used to calculate FPS</h2>
<p>Since actual frame rendering is not directly related to javascript based DOM or CSS modifications, relying solely on javascript loops to measure an animation framerate will most likely lead to very optimistic results (see for instance the <a href="http://bubblemark.com/dhtml.htm">Bubblemark</a> javascript based benchmark that gives awesome results even when the actual rendering looks completely frozen).</p>
<p>Even worse, with CSS triggered animations, there is no way for the javascript to be notified of a new frame being rendered (actually, the whole point of this new CSS stuff is to avoid the javascript overhead).</p>
<h2>How CSS can be used to calculate FPS (with a little javascript also)</h2>
<p>Having thought a little about this issue, I came up with the idea of using CSS itself to evaluate the actual rendering framerate of a page.</p>
<p>The principle is quite simple:<br />
- insert a very simple CSS animated item in a page,<br />
- calculate the computed position of this item at regular intervals,<br />
- every second that has elapsed, count the number of different positions occupied by the item.    </p>
<p>Pretty dumb, uh ? Well, maybe, but it gives surprisingly accurate results, actually &#8230;</p>
<p>Obviously, this only works on browser supporting CSS transitions/animations, but these are actually the implementations we want to evaluate, so this isn&#8217;t really an issue.</p>
<h2>The FPSMeter script</h2>
<p>I have developed a little script that does just what I&#8217;ve described in the previous paragraph.</p>
<p>Get the script <a href="/code/kaizoumark/FPSMeter.js">Here</a>.</p>
<p>Here is a brief HowTo:</p>
<p>1 &#8211; Include the FPSMeter script to your page</p>
<pre>
<code>    &lt;script type="text/javascript" src="&lt;path_to&gt;/FPSMeter.js"&gt;&lt;/script&gt;</code>
</pre>
<p>2 &#8211; Add two call-back functions to your page to monitor progress and gather the final results</p>
<pre>
<code>function log(fps){
// Do some stuff here with current FPS
}
function end(minfps,avgfps,maxfps){
// Do some other stuff here with min, max and avg fps
}</code>
</pre>
<p>3 &#8211; In your page initialization code, instantiate an FPSMeter object, providing the call-backs as parameters</p>
<pre><code>fpsMeter = new FPSMeter(log,end);</code></pre>
<p>4 &#8211; Run the FPS meter for n seconds</p>
<pre><code>fpsMeter.run(n);</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/06/effectively-measuring-browser-framerate-using-css/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pure CSS Bouncing Balls</title>
		<link>http://www.kaizou.org/2011/06/pure-css-bouncing-balls/</link>
		<comments>http://www.kaizou.org/2011/06/pure-css-bouncing-balls/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 08:13:24 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[balls]]></category>
		<category><![CDATA[bouncing]]></category>
		<category><![CDATA[css 3]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=528</guid>
		<description><![CDATA[Yet another example of how easy it is to design animations with the new CSS 3 primitives. Click on the picture to see the live version. It works on Chrome, Safari and Firefox.]]></description>
			<content:encoded><![CDATA[<p>Yet another example of how easy it is to design animations with the new CSS 3 primitives.</p>
<p><a href="/code/bouncing-balls"><br />
<img src="/code/bouncing-balls/bouncing-balls.jpg"></img><br />
</a><br />
Click on the picture to see the live version.<br />
It works on Chrome, Safari and Firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/06/pure-css-bouncing-balls/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Pure CSS Carousel</title>
		<link>http://www.kaizou.org/2011/06/pure-css-carousel/</link>
		<comments>http://www.kaizou.org/2011/06/pure-css-carousel/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 20:00:10 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[carousel]]></category>
		<category><![CDATA[coverflow]]></category>
		<category><![CDATA[css 3]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=513</guid>
		<description><![CDATA[I have been playing for a while with CSS transitions and animations, but I didn&#8217;t take the time to post anything on the subject. Here is a small example of a pure CSS carousel using CSS3 animations. It works on Chrome, Safari (with a few z-index glitches), and hopefully soon on Firefox 5.0.]]></description>
			<content:encoded><![CDATA[<p>I have been playing for a while with CSS transitions and animations, but I didn&#8217;t take the time to post anything on the subject.<br />
Here is a small example of a pure CSS carousel using CSS3 animations.<br />
<object width="800" height="600" data="/code/carousel" style="overflow:hidden"></object><br />
It works on Chrome, Safari (with a few z-index glitches), and hopefully soon on Firefox 5.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/06/pure-css-carousel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kaizoumark: a browser animation benchmark</title>
		<link>http://www.kaizou.org/2011/06/kaizoumark-a-browser-animation-benchmark/</link>
		<comments>http://www.kaizou.org/2011/06/kaizoumark-a-browser-animation-benchmark/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 08:31:21 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[css 3]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=483</guid>
		<description><![CDATA[After years of Flash dominance, HTML5 and CSS3 are now bringing many eye-candy features allowing the development of pure-web rich user interfaces (Canvas, CSS animations &#038; transitions, WebGL). At the same time, the development of native applications on smartphones &#038; tablets have raised the users level of expectations towards GUI to a point that &#8220;plain [...]]]></description>
			<content:encoded><![CDATA[<p>After years of Flash dominance, HTML5 and CSS3 are now bringing many eye-candy features allowing the development of pure-web rich user interfaces (Canvas, CSS animations &#038; transitions, WebGL).</p>
<p>At the same time, the development of native applications on smartphones &#038; tablets have raised the users level of expectations towards GUI to a point that &#8220;plain old web&#8221; user interfaces are not an option anymore.</p>
<p>But do current implementations live up to the expectations ? This has yet to be demonstrated &#8230;</p>
<p>The sad truth is that even on desktop, the CPU alone cannot cope with the level of complexity that is today required to develop a fancy user interface, and browser vendors are struggling to take advantage of hardware accelerations provided by blitters or GPUs. Due to the huge diversity of hardware configurations available, this leads to a very fragmented landscape for the poor web developer.</p>
<p>That said, how can we users help things getting better ? By providing feedback on how well their implementation behave to the browser developers &#8230;</p>
<p>For that purpose, I have designed a small browser animation benchmark test that calculates the number of frames the browser is displaying per seconds while an animation plays.</p>
<p>Note: If you want to know how the framerate is evaluated, see <a href="/2011/06/effectively-measuring-browser-framerate-using-css">this post</a>.</p>
<p>It now only works for Firefox, Chrome, Safari and Opera (IE is not supported).</p>
<p>It currently only tests CSS 2D features, but I will add more tests later.</p>
<p>At some point in the future I will also try to add some mechanism to have results gathered in a database, but in the meantime, you can post your result as a comment, specifying your hardware configuration, operating system and browser version.</p>
<p>Click on the link below to benchmark your browser.</p>
<p><a href="/code/kaizoumark" style="font-family: 'Soviet';font-size:30px;background-color:darkorange;border-radius:5px;border:3px solid red"> kaizoumark </a></p>
<p>Some results:</p>
<p>On a Dell Latitude D620 Laptop running Windows XP:</p>
<p>Chrome 13.0.782.24</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>38 fps</td>
<td>38 fps</td>
<td>32 fps</td>
<td>17 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>38 fps</td>
<td>37 fps</td>
<td>17 fps</td>
<td>8 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>38 fps</td>
<td>38 fps</td>
<td>35 fps</td>
<td>16 fps</td>
</tr>
</tbody>
</table>
<p>Firefox 5</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>59 fps</td>
<td>53 fps</td>
<td>26 fps</td>
<td>13 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>59 fps</td>
<td>33 fps</td>
<td>7 fps</td>
<td>2 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>57 fps</td>
<td>49 fps</td>
<td>20 fps</td>
<td>10 fps</td>
</tr>
</tbody>
</table>
<p>Safari 5.0.3</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>40 fps</td>
<td>40 fps</td>
<td>34 fps</td>
<td>19 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>41 fps</td>
<td>38 fps</td>
<td>12 fps</td>
<td>5 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>40 fps</td>
<td>40 fps</td>
<td>36 fps</td>
<td>18 fps</td>
</tr>
</tbody>
</table>
<p>Opera 11.11</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>48 fps</td>
<td>47 fps</td>
<td>46 fps</td>
<td>40 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>49 fps</td>
<td>47 fps</td>
<td>35 fps</td>
<td>18 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
</tr>
</tbody>
</table>
<p>On an Iphone 3GS running iOS 4.3.3:</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>23 fps</td>
<td>22 fps</td>
<td>4 fps</td>
<td>2 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>31 fps</td>
<td>3 fps</td>
<td>1 fps</td>
<td>1 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>18 fps</td>
<td>23 fps</td>
<td>7 fps</td>
<td>3 fps</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/06/kaizoumark-a-browser-animation-benchmark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the current page subtleties</title>
		<link>http://www.kaizou.org/2011/03/changing-the-current-page-subtleties/</link>
		<comments>http://www.kaizou.org/2011/03/changing-the-current-page-subtleties/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 18:03:22 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=464</guid>
		<description><![CDATA[The window.location object has two methods to tell the browser to navigate to a new URL: replace and assign. The only difference between the two methods is that window.location.replace will not insert a new page in the history: as a consequence, the user will not be able to return to the original page using the [...]]]></description>
			<content:encoded><![CDATA[<p>The window.location object has two methods to tell the browser to navigate to a new URL: <code>replace</code> and <code>assign</code>.<br />
The only difference between the two methods is that <code>window.location.replace</code> will not insert a new page in the history: as a consequence, the user will not be able to return to the original page using the back button of the browser.<br />
In all automatic redirection use cases, using <code>window.location.replace</code> makes sense, as the web developer probably doesn&#8217;t want the user to be able to come back to the original page, but there are several other use cases where <code>window.location.assign</code> makes more sense, because you actually want the user to be able to use the back button.<br />
So, you would expect both methods to be equally popular, right ? Wrong !<br />
Google search on <code>window.location.replace</code> -> more than 47 millions responses &#8230;<br />
Google search on <code>window.location.assign</code> -> only 280 000 responses !<br />
Okay, maybe that&#8217;s because <code>window.location.assign("url")</code> is equivalent to <code>window.location.href="url"</code>. Well, not only &#8230;<br />
Google search on <code>window.location.href</code> -> &#8220;only&#8221; 12 millions responses &#8230;<br />
So, I am now wondering whether people use <code>window.location.replace</code> because it is what they need or just because it comes out first when they google for a way to change a page using javascript &#8230;    </p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/03/changing-the-current-page-subtleties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML 5 offline web applications</title>
		<link>http://www.kaizou.org/2009/04/html-5-offline-web-applications/</link>
		<comments>http://www.kaizou.org/2009/04/html-5-offline-web-applications/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 17:21:21 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[cache-manifest]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[offline]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=355</guid>
		<description><![CDATA[HTML 5 provides a new caching feature to support offline web applications. Basically, you can specify in a specific file called the &#8220;cache manifest&#8221; the caching policy to apply to a particular web page. To activate the HTML 5 caching feature for a specific document, you only need to specify the URI of the cache [...]]]></description>
			<content:encoded><![CDATA[<p>HTML 5 provides a new caching feature to support <a href="http://www.w3.org/TR/offline-webapps/" alt="HTML 5 offline web applications">offline web applications</a>.</p>
<p>Basically, you can specify in a specific file called the &#8220;cache manifest&#8221; the caching policy to apply to a particular web page.</p>
<p>To activate the HTML 5 caching feature for a specific document, you only need to specify the URI of the cache manifest file in the <code>manifest</code> attribute of the <code>&lt;html&gt;</code> element.</p>
<pre>
<code>&lt;!DOCTYPE HTML&gt;
&lt;html manifest="myapp.cache"&gt;
...</code>
</pre>
<p>The file that references the cache manifest file is called the <a href="http://www.whatwg.org/specs/web-apps/current-work/#concept-appcache-master" alt="HTML 5 cache master entry">master entry</a>.</p>
<p>Please note that to be properly parsed by the browser, the manifest file must have a <code>text/cache-manifest</code> MIME type (which means that you will need either to add a custom file type extension binding to your web server or to specify manually the mime-type, for instance using PHP <code>header</code> directive).</p>
<p>A cache manifest file typically looks like this:</p>
<pre>
<code>CACHE MANIFEST
index.html
style.css
images/logo.png

NETWORK:
search.php</code>
</pre>
<p>This file specifies several files to cache (the cache <a href="http://www.whatwg.org/specs/web-apps/current-work/#concept-appcache-explicit" alt="HTML 5 cache explicit entries">explicit entries</a>), and then specifies that search.php should never be cached (it is said to belong to the <a href="http://www.whatwg.org/specs/web-apps/current-work/#concept-appcache-onlinewhitelist" alt="HTML 5 cache online white-list">online white list</a>), so that any attempt to access that file will bypass the cache.</p>
<p>Whenever the user browses to the page corresponding to a document to which a cache manifest is associated, the browser must check on the server if the latter has been modified:</p>
<ul>
<li>If it hasn&#8217;t, then the cached content is used,</li>
<li>If a new version of the cache manifest exists, then the cached content is considered as staled and reloaded from the server.</li>
</ul>
<p>The cache manifest for a document may also contain <a href="http://www.whatwg.org/specs/web-apps/current-work/#concept-appcache-fallback" alt="HTML 5 cache fallback entries">fallback entries</a> that can be used if the browser can&#8217;t retrieve the original content. Below is an example where a static image is used when the retrieval of a dynamically generated image fails:</p>
<pre>
<code>CACHE MANIFEST
FALLBACK:
images/mirror-effect.php server-busy.jpg</code>
</pre>
<p>HTML 5 also defines an <a href="http://www.whatwg.org/specs/web-apps/current-work/#application-cache-api" alt="HTML 5 application cache API">application cache API</a> to manually trigger cache updates:</p>
<ul>
<li><a href="http://www.whatwg.org/specs/web-apps/current-work/#dom-appcache-update" alt="HTML 5 cache update method"><code>update()</code></a>: updates the cache for the current document in the background,</li>
<li><a href="http://www.whatwg.org/specs/web-apps/current-work/#dom-appcache-swapcache" alt="HTML 5 swap cache method"><code>swapCache()</code></a>: reflow the HTML document using updated cached content,</li>
<li><a href="http://www.whatwg.org/specs/web-apps/current-work/#handler-appcache-onupdateready" alt="HTML 5 cache updateready event"><code>onupdateready()</code></a>: event triggered when the cache content has been updated,</li>
<li><a href="http://www.whatwg.org/specs/web-apps/current-work/#handler-appcache-onobsolete" alt="HTML 5 cache obsolete event"><code>onobsolete()</code></a>: event triggered when the cache content has been marked as obsolete,</li>
<li>&#8230;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/04/html-5-offline-web-applications/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>HTML 5 &lt;audio&gt; &amp; &lt;video&gt; elements</title>
		<link>http://www.kaizou.org/2009/04/html-5-audio-video-elements/</link>
		<comments>http://www.kaizou.org/2009/04/html-5-audio-video-elements/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 17:08:37 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=333</guid>
		<description><![CDATA[One of the most revolutionary concept introduced by HTML 5 is the native support of audio and video playback in web pages. Two new HTML elements have been defined for that purpose: &#60;audio&#62; and &#60;video&#62;, based on the generic media element type. Media elements use a common set of attributes: src: defines the source of [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most revolutionary concept introduced by <a href="http://www.w3.org/TR/html5/" alt="HTML W3C specification">HTML 5</a> is the native support of audio and video playback in web pages.</p>
<p>Two new HTML elements have been defined for that purpose: <a href="http://www.w3.org/TR/html5/video.html#audio" alt="HTML 5 audio element"><code>&lt;audio&gt;</code></a> and <a href="http://www.w3.org/TR/html5/video.html#video" alt="HTML 5 video element"><code>&lt;video&gt;</code></a>, based on the generic <a href="http://www.w3.org/TR/html5/video.html#media-element" alt="HTML 5 media elements">media element type</a>.</p>
<p><a href="http://www.w3.org/TR/html5/video.html#media-element" alt="HTML 5 media elements">Media elements</a> use a common set of attributes:</p>
<ul>
<li><a href="http://www.w3.org/TR/html5/video.html#attr-media-src" alt="HTML 5 media element src attribute"><code>src</code></a>: defines the source of the media to render,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#attr-media-autoplay" alt="HTML 5 media element autoplay attribute"><code>autoplay</code></a>: boolean to activate|prevent immediate playback,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#attr-media-loop" alt="HTML 5 media element loop attribute"><code>loop</code></a>: boolean to activate|prevent automatic looping on content,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#attr-media-controls" alt="HTML 5 media element controls attribute"><code>controls</code></a>: boolean to display|hide browser playback user interface.</li>
</ul>
<p><a href="http://www.w3.org/TR/html5/video.html#video" alt="HTML 5 video element"><code>&lt;video&gt;</code></a> and <a href="http://www.w3.org/TR/html5/video.html#audio" alt="HTML 5 audio element"><code>&lt;audio&gt;</code></a> elements can contain elements to be displayed to the user in older browsers that do not support these new elements.</p>
<p>Below is an example of how to use the <a href="http://www.w3.org/TR/html5/video.html#audio" alt="HTML 5 audio element"><code>&lt;audio&gt;</code></a> element:</p>
<pre>
<code>&lt;audio src="audio.ogv" controls width="100" height="50"&gt;
    &lt;a href="audio.ogv"&gt;Listen&lt;/a&gt;
&lt;/audio&gt;</code>
</pre>
<p>Alternatively to the <a href="http://www.w3.org/TR/html5/video.html#attr-media-src" alt="HTML 5 media element src attribute"><code>src</code></a> attribute, the content to be rendered can be specified using one or more <a href="http://www.w3.org/TR/html5/video.html#the-source-element" alt="HTML 5 source element"><code>&lt;source&gt;</code></a> elements, each of them describing a specific <a href="http://www.w3.org/TR/html5/video.html#media-resource" alt="HTML 5 media resource">media resource</a>.</p>
<p>Each <a href="http://www.w3.org/TR/html5/video.html#the-source-element" alt="HTML 5 source element"><code>&lt;source&gt;</code></a> can be identified by its <a href="http://www.w3.org/TR/html5/video.html#attr-media-src" alt="HTML 5 media element src attribute"><code>src</code></a> and <a href="http://www.w3.org/TR/html5/video.html#attr-source-type" alt="HTML 5 source type attribute"><code>type</code></a> attributes, optionally complemented by a <a href="http://www.w3.org/TR/html5/video.html#attr-source-codecs" alt="HTML 5 media element codecs attribute"><code>codecs</code></a> attribute:</p>
<pre>
<code>&lt;audio controls width="100" height="50"&gt;
     &lt;source src="audio.ogg" type="audio/ogg; codecs=vorbis"&gt;
    &lt;source src="audio.spx" type="audio/ogg; codecs=speex"&gt;
    &lt;source src="audio.oga" type="audio/ogg; codecs=flac"&gt;
&lt;/audio&gt;</code>
</pre>
<p>The  <a href="http://www.w3.org/TR/html5/video.html#video" alt="HTML 5 video element"><code>&lt;video&gt;</code></a> element has an optional <a href="http://www.w3.org/TR/html5/video.html#attr-video-poster" alt="HTML 5 video element poster attribute"><code>poster</code></a> attribute that can be used to define an image to be displayed before the video is played:</p>
<pre>
<code>&lt;video src="oggy.ogv" poster="oggy.jpg" /&gt;</code>
</pre>
<p>These new <a href="http://www.w3.org/TR/html5/video.html#media-element" alt="HTML 5 media elements">media elements</a> also support a set of handy javascript method, properties and events, to allow the fine-grained control of the rendered UI.</p>
<ul>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-play" title="HTML 5 media play method">play()</a></li>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-pause" title="HTML 5 media pause method">pause()</a></li>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-currenttime" title="HTML 5 media playback time attribute">currentTime</a>: current playback time,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-duration" title="HTML 5 media duration attribute">duration</a>: overall duration of the media,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-playbackrate" title="HTML 5 media playback rate attribute">playbackRate</a>: playback speed (can be negative !),</li>
<li><a href="http://www.w3.org/TR/html5/video.html#event-play" title="HTML 5 media play event">onplay()</a>: content has just start playing,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#event-pause" title="HTML 5 media pause event">onpause()</a>: content playback has just been paused,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#event-error" title="HTML 5 media error event">onerror()</a>: an error occurred,</li>
<li>&#8230;</li>
</ul>
<pre>
<code>&lt;script&gt;
function playVideo(url){
     var video = document.getElementById("video");
     video.setAttribute("src",url);
}
&lt;/script&gt;
&lt;video id="videoPlayer" controls=false/&gt;
&lt;p&gt;
     &lt;button type="button"
             onclick="video.playbackRate = -2;"&gt;
         Rew
     &lt;/button&gt;
     &lt;button type="button"
             onclick="video.play();"&gt;
         Play
     &lt;/button&gt;
     &lt;button type="button"
             onclick="video.pause();"&gt;
         Pause
     &lt;/button&gt;
     &lt;button type="button"
                 onclick="video.playbackRate = 2;"&gt;
         FF
     &lt;/button&gt;
&lt;/p&gt;</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/04/html-5-audio-video-elements/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>New HTML 5 block-level elements</title>
		<link>http://www.kaizou.org/2009/03/new-html-5-block-level-elements/</link>
		<comments>http://www.kaizou.org/2009/03/new-html-5-block-level-elements/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 11:59:51 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=299</guid>
		<description><![CDATA[The HTML 5 specification introduces new block elements that can be used to structure documents: &#60;section&#62;: represents a document or application section (a content column for instance), &#60;article&#62;: represents an independent piece of content inside a document/section (a blog entry for instance), &#60;aside&#62;: represents a piece of content not directly related to the displayed content [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.w3.org/TR/html5/" alt="W3C HTML 5 Draft">HTML 5 specification</a> introduces new block elements that can be used to structure documents:</p>
<ul>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-section-element" alt="HTML 5 section element"><code>&lt;section&gt;</code></a>: represents a document or application section (a content column for instance),</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-article-element" alt="HTML 5 article element"><code>&lt;article&gt;</code></a>: represents an independent piece of content inside a document/section (a blog entry for instance),</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-aside-element" alt="HTML 5 aside element"><code>&lt;aside&gt;</code></a>: represents a piece of content not directly related to the displayed content (typically a sidebar),</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-header-element" alt="HTML 5 header element"><code>&lt;header&gt;</code></a>: represents a document header,</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-footer-element" alt="HTML 5 footer element"><code>&lt;footer&gt;</code></a>: represents a document footer,</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-nav-element" alt="HTML 5 nav element"><code>&lt;nav&gt;</code></a>: represents a block of navigation links (typically a blog navigation bar),</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-dialog-element" alt="HTML 5 dialog element"><code>&lt;dialog&gt;</code></a>: can be used to render a chat session, using complementary <a href="http://www.w3.org/TR/html5/semantics.html#the-dt-element" alt="HTML 5 dt element"><code>&lt;dt&gt;</code></a> (talker) and <a href="http://www.w3.org/TR/html5/semantics.html#the-dt-element" alt="HTML 5 dd element"><code>&lt;dd&gt;</code></a> (quote) tags,</li>
<li><a href="http://www.w3.org/TR/html5/embedded-content-0.html#the-figure-element" alt="HTML 5 figure element"><code>&lt;figure&gt;</code></a>: can be used to provide textual information about an embedded content,</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-address-element" alt="HTML 5 address element"><code>&lt;address&gt;</code></a>: represents a document/section contact block,</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/03/new-html-5-block-level-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

