<?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>larryaronson.com &#187; Featured</title>
	<atom:link href="http://larryaronson.com/category/featured/feed/" rel="self" type="application/rss+xml" />
	<link>http://larryaronson.com</link>
	<description>Systems Psychoanalyst</description>
	<lastBuildDate>Thu, 10 May 2012 20:31:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>15 HTML5 FAQs</title>
		<link>http://larryaronson.com/2011/15-html5-faqs/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2011/15-html5-faqs/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 14:34:41 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[FAQ]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[HMTL5 shim]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Modernizer]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[W3C]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1818</guid>
		<description><![CDATA[<img class="alignleft size-thumbnail wp-image-1851" title="fifteen" src="http://larryaronson.com/wp-content/uploads/fifteen.jpeg" alt="" width="80" height="56" />A lot of people are curious about HTML5 but few really understand what it's about and many have misconceptions about it. Here are 15 frequently asked questions about HTML5 with my short answers. ]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1851" title="fifteen" src="http://larryaronson.com/wp-content/uploads/fifteen.jpeg" alt="" width="240" height="169" />Since the publication of <a href="http://larryaronson.com/2010/html-manual-of-style/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><cite>HTML Manual of Style</cite></a>, I&#8217;ve attended a number of meetups and participated in a few forums to promote the book. While a lot of people are curious about HTML5, few really understand what it&#8217;s about and many have misconceptions.  So, I&#8217;ve collected 15 frequently asked questions about HTML5 along with my short answers in an effort to clear up some of the confusion. Click on a question to toggle open/close its answer.</p>
<div style="font-size: 95%; background-color: #f7f7f7; margin: .5em; padding: .5em;">
<ol>
<li>
<h3><a onclick="$('#a01').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Is HTML5 is the new standard for creating Web pages?</a></h3>
<p id="a01">Not Quite. HTML5 is a <a href="http://www.w3.org/TR/html5/" target="_blank">draft proposal</a> for a standard that will eventually be submitted to international standards organizations which may adopt HTML5 as a standard or may choose to adopt a competing proposal. Right now there&#8217;s no serious contender to HTML5 and all of the big players: Apple, Google, Mozilla, Microsoft and Adobe are behind it, so it is becoming the de-facto standard. However, it is still early in the process. The <a href="http://www.w3.org/" target="_blank">World Wide Web Consortium</a> (W3C) expects to finalize the draft and start the process of final review and requests for comments in 2012. Final acceptance as a standard will happen several years after that.</p>
</li>
<li>
<h3><a onclick="$('#a02').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Is HTML5 a new technology?</a></h3>
<p id="a02">No. It&#8217;s an extension of existing HTML, adding new elements to the set recognized by HTML4 level browsers and removing some of the restrictions of xhtml.</p>
</li>
<li>
<h3><a onclick="$('#a03').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">How does HTML5 affect my existing HTML4 website?</a></h3>
<p id="a03">It doesn&#8217;t. The HTML5 specifications require browser makers to support valid HTML4 web pages. You should update your HTML editing tools when new versions are available. If your web pages require a diet of strict xhtml, you should validate any third-party HTML5 code to one of the xhtml standards before embedding that code into your own pages.</p>
</li>
<li>
<h3><a onclick="$('#a04').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">What is new about HTML5?</a></h3>
<p id="a04">Several things. The biggest change is that HTML5 documents are explicitly recognized as interactive applications. Every document element in HTML5 has a corresponding JavaScript API that describes how that element should behave in response to user actions and other events.</p>
</li>
<li>
<h3><a onclick="$('#a05').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Are there new HTML5 tags?</a></h3>
<p id="a05">Yes, there are new HTML5 elements that provide richer semantic descriptions of documents: <span style="font-family: courier new,courier;">section</span>, <span style="font-family: courier new,courier;">article</span>, <span style="font-family: courier new,courier;">header</span>, <span style="font-family: courier new,courier;">hgroup</span>, <span style="font-family: courier new,courier;">footer</span>, <span style="font-family: courier new,courier;">aside</span> and <span style="font-family: courier new,courier;">nav</span>; new media elements: <span style="font-family: courier new,courier;">audio</span>, <span style="font-family: courier new,courier;">video</span> and <span style="font-family: courier new,courier;">canvas</span>; new form input types: <em>email</em>, <em>url</em>, <em>number</em> <em>range</em> and <em>search</em>; and a bunch of new element attributes.</p>
</li>
<li>
<h3><a onclick="$('#a06').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Have any HTML elements changed their meaning or how they are used?</a></h3>
<p id="a06">Yes, but not many. The <span style="font-family: courier new,courier;">small</span> element, which in HTML4 has no semantic value—it just means make the text smaller—is used in HTML5 to markup disclaimers, legal notices and the like—the small print. The <span style="font-family: courier new,courier;">anchor</span> element, which creates hyperlinks, can now enclose any other elements excluding other links and buttons. In HTML4, the anchor was strictly an inline element.</p>
</li>
<li>
<h3><a onclick="$('#a07').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Are there things in HTML4 that are not in HTML5?</a></h3>
<p id="a07">Yes, but only a handful of elements and these are not really gone; they are just marked as <em>obsolete</em>. Browser makers can continue to support these elements in their new versions and most will. Among the elements marked as obsolete in HTML5 are: <span style="font-family: courier new,courier;">frame</span>, <span style="font-family: courier new,courier;">frameset</span>, <span style="font-family: courier new,courier;">big</span>, <span style="font-family: courier new,courier;">center</span>, <span style="font-family: courier new,courier;">font</span>, <span style="font-family: courier new,courier;">strike</span>, <span style="font-family: courier new,courier;">acronym</span>, <span style="font-family: courier new,courier;">applet</span>, <span style="font-family: courier new,courier;">isindex</span> and <span style="font-family: courier new,courier;">dir</span>.</p>
</li>
<li>
<h3><a onclick="$('#a08').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">What exactly is HTML5 Video?</a></h3>
<p id="a08">Nothing, really. The term <em>HTML5 video</em> is used to differentiate the playing of a video directly by a browser encountering a web page&#8217;s <span style="font-family: courier new,courier;">video</span> element, as opposed to being played by a third-party browser plugin via an <span style="font-family: courier new,courier;">object</span> or <span style="font-family: courier new,courier;">embed</span> element. There is nothing intrinsic about any video that makes it HTML5-ish as opposed to Flash-ish. The distinction is entirely a matter of how the a web page is coded to present the video.</p>
</li>
<li>
<h3><a onclick="$('#a09').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Is HTML5 video better than Flash video?</a></h3>
<p id="a09">Yes, but not in terms of video quality which is a function of how the video data is encoded. HTML5 video is better because the <span style="font-family: courier new,courier;">video<em> </em></span>element can interact with other elements on the page and can be styled using CSS. Also, HTML5 video should use less resources because it is built into the browser.</p>
</li>
<li>
<h3><a onclick="$('#a10').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Will HTML5 kill Adobe&#8217;s Flash?</a></h3>
<p id="a10">Nope, Flash will be around for a long time. As a media player, Flash accommodates digital rights management (DRM) which hasn&#8217;t been addressed in the HTML5 specs. As an applications platform, Flash has a large, installed base in corporate environments where there&#8217;s no compelling rationale for rewriting working applications in HTML5. For new applications, HTML5 has advantages over Flash: content is better exposed to search engines, there&#8217;s complete integration with other document elements, no plugins are required and HTML5 tools are free.</p>
</li>
<li>
<h3><a onclick="$('#a11').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Is HTML5 is a threat to Microsoft?</a></h3>
<p id="a11">No. Microsoft embraces HTML5. The IE9 beta has received high marks for its HTML5 support. Silverlight is not the only path to interactivity in Redmond.</p>
</li>
<li>
<h3><a onclick="$('#a12').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Is HTML5 ready for prime time?</a></h3>
<p id="a12">Some of it is and some of it isn&#8217;t. New HTML5 semantic elements have good support in all modern browsers, including IE if an <a href="http://code.google.com/p/html5shim/" target="_blank">HTML5 shim</a> or the <a href="http://www.modernizr.com/" target="_blank">Modernizer JavaScript library</a> is loaded into a web page. The <span style="font-family: courier new,courier;">audio</span>, <span style="font-family: courier new,courier;">video</span> and <span style="font-family: courier new,courier;">canvas</span> elements are not supported in Internet Explorer yet, but these elements are designed to gracefully fail and fallback to other technologies, like Flash and Silverlight, in legacy browsers. Other technologies that are associated with HTML5 such as Mathematical Markup Language (MathML), Scalable Vector Graphics (SVG), Web Sockets, Web Storage and Geo-location have only limited support in the current crop of browsers.</p>
</li>
<li>
<h3><a onclick="$('#a13').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Where can I get an HTML5 browser?</a></h3>
<p id="a13"><a href="http://www.opera.com/" target="_blank">Opera</a>, <a href="http://www.google.com/chrome/" target="_blank">Chrome</a> and <a href="http://www.apple.com/safari/" target="_blank">Safari</a> provide pretty solid support for HTML5 in their current versions including their browsers for iPhones, iPads and Droids. Firefox&#8217;s support for HTML5 is weak in its current version (3.6) but quite robust in the Firefox4 public beta.</p>
</li>
<li>
<h3><a onclick="$('#a14').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">What about Internet Explorer?</a></h3>
<p id="a14">Internet Explorer is late to the HTML5 party. There&#8217;s no HTML5 support in IE8 or previous versions. However, adding a JavaScript library such as <a href="http://code.google.com/p/html5shim/" target="_blank">Google&#8217;s HTML5 shim</a> or <a href="http://www.modernizr.com/" target="_blank">Modernizer</a> enables IE 6, 7 &amp; 8 to recognize the new semantic level elements so they can be styled with CSS. HTML5 support is good in the beta version of IE9 which is available for Windows Vista and Seven users. Unfortunately, the Windows 7 mobile browser is built largely on the IE7 code base.</p>
</li>
<li>
<h3><a onclick="$('#a15').toggle('slow')" href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">What is an HTML5 application?</a></h3>
<p id="a15">There are several new capabilities in HTML5 which directly address the need for creating interactive applications. Of course, HTML has had interactive capabilities since its early days with text-based input forms and HMTL5 expands these with new input types. New capabilities include page and session-based data storage in the user&#8217;s browser, Web sockets for inter-application communications, and a drawing environment,  the <span style="font-family: courier new,courier;">canvas</span> element, for creating and manipulating image data.</p>
</li>
</ol>
</div>
<p>
<script type="text/javascript">// <![CDATA[
$(document).ready(function () {$('#a01,#a02,#a03,#a04,#a05,#a06,#a07,#a08,#a09,#a10,#a11,#a12,#a13,#a14,#a15').hide('slow');} )
// ]]&gt;</script></p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2011/15-html5-faqs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Understanding HTML5 Audio</title>
		<link>http://larryaronson.com/2010/understanding-html5-audio/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2010/understanding-html5-audio/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 00:14:04 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[Napster]]></category>
		<category><![CDATA[ogg]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[sound effects]]></category>
		<category><![CDATA[wav]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1640</guid>
		<description><![CDATA[<a href="http://larryaronson.com/2010/understanding-html5-audio/"><img src="http://larryaronson.com/wp-content/uploads/hismastersvoice.jpg" alt="His Master&#039;s Voice" title="hismastersvoice" width="75" height="54" class="alignleft size-thumbnail wp-image-1741" /></a>A quickie tutorial on the HTML5 audio element and its JavaScript API. Examples illustrate applications such as: background music, sound effects, alert noises and audio content. ]]></description>
			<content:encoded><![CDATA[<p><audio id="ella" preload><br />
  <source src="http://larryaronson.com/wp-content/uploads/swonderful.ogg" type="audio/ogg" /><br />
  <source src="http://larryaronson.com/wp-content/uploads/swonderful.mp3" type="audio/mpeg" /><br />
</audio><br />
<audio id="thanks" preload><br />
  <source src="http://larryaronson.com/wp-content/uploads/thanks.ogg" type="audio/ogg" /><br />
  <source src="http://larryaronson.com/wp-content/uploads/thanks.mp3" type="audio/mpeg" /><br />
</audio></p>
<h2>Now Hear This!</h2>
<p><img src="http://larryaronson.com/wp-content/uploads/hismastersvoice.jpg" alt="His Master&#039;s Voice" title="hismastersvoice" width="240" height="172" class="alignleft size-full wp-image-1741" />With all the talk about Flash versus HTML5 you might be forgiven for thinking that HTML5 is just about video. It&#8217;s not, of course. HTML5 is a major extension of HTML in many areas including media.</p>
<p> Today, I&#8217;d like to explore <strong>HTML5 audio</strong>, which is similar to HTML5 video in many respects, but fundamentally different in others. For starters, a video element is essentially just a TV set embedded in a webpage whereas audio can serve multiple purposes &ndash; four examples:</p>
<ul style="margin: 1em auto;">
<li><strong>Sound effects</strong>. A button can make a sound when it&#8217;s clicked. How about a swoosh sound when a division is toggled open or closed?</li>
<li><strong>Alerts and notifications</strong>. A little bell can sound when an AJAX request completes and updates a page section. Or, an audio &#8220;Uh Oh!&#8221; can play when you enter a malformed email address into a input field.</li>
<li><strong>Background sounds</strong>. Some web pages can benefit from background music. But say you have a photo gallery of birds. Wouldn&#8217;t it be nice to be able to click one and hear it tweet?</li>
<li><strong>Spoken content</strong>. Yes, we have podcasts, but we also need something simpler such as  pronunciations of foreign words and phrases, or a click-to-have-this-post-read-to-you feature so you can go off and browse other webpages while I continue to read this one to you.</li>
</ul>
<p>S i l e n c e.</p>
<h3>Yo Dawg, I can&#8217;t hear your website!</h3>
<p>This isn&#8217;t as dumb a statement as it first, um, sounds. Web developers have shied away from including sound in webpages because of several  difficulties:</p>
<ul>
<li><strong>Confusion</strong> &ndash; There are codecs and there are file formats. A codec is a method of encoding audio data. A file format is a container for the codec and optional metadata, such as a song title. Some file formats can accommodate multiple codecs; other formats are codec specific. For simplicity, we can narrow this discussion to the most popular file formats/codecs for the Web. These are:
<ul style="margin: 1em auto">
<li><strong>wav</strong> &ndash; An uncompressed format. A wav file with 30 seconds of silence is the same size (megabytes) as a file with 30 seconds of symphonic music.</li>
<li><strong>mp3</strong> &ndash; A popular format for music that uses a lossy compression format resulting in file sizes typically 1/10 the size of a wav file with the same audio content.</li>
<li><strong>ogg</strong>  &ndash; An open-source alternative to mp3 that also uses a lossy compression format.</li>
</ul>
</li>
<li><strong>Cross-browser incompatibility</strong> &ndash; Unlike images, where all major browsers support the three major file types&mdash;gif, jpg and png&mdash;all browsers do not support all audio formats. For instance: mp3 is a proprietary format and its decoding software cannot be included in  GPL-licensed, open-source applications such as the Mozilla Foundation&#8217;s Firefox browser. Here&#8217;s a table showing which formats are supported by the current versions of the major web browsers:<br />
<table width="90%"  border="1" cellspacing="0" cellpadding="6" style="margin: 1em auto;">
<tr>
<th></th>
<th>IE</th>
<th>Firefox</th>
<th>Safari</th>
<th>Chrome</th>
<th>Opera</th>
</tr>
<tr>
<th>wav</th>
<td>NO</td>
<td>YES</td>
<td>YES</td>
<td>NO</td>
<td>NO</td>
</tr>
<tr>
<th>mp3</th>
<td>NO*</td>
<td>NO</td>
<td>YES</td>
<td>YES</td>
<td>YES</td>
</tr>
<tr>
<th>ogg</th>
<td>NO</td>
<td>YES</td>
<td>NO</td>
<td>YES</td>
<td>NO</td>
</tr>
</table>
<p><span style="font-size: x-small">(* IE8 does not recognize the audio element at all. The IE9 beta works only with mp3 files. )</span></li>
<li><strong>Plugin required </strong>&ndash; HTML4 Browsers do not support audio natively. A plugin is required and JavaScript must be enabled. While most browsers support audio with a distributed default plugin, web developers must still use the ugly and opaque <i>object</i>, <i>embed</i> and <i>param</i> elements to bring sounds to a webpage.</li>
<li><strong>Insufficient processing power</strong> &ndash; For the first time visitor to a page, it can take several seconds for an older or overloaded browser to load the player code, download, decode and play a audio file. This pretty much nixes using sound for mouseover effects, even simple click sounds for navigation buttons.</li>
</ul>
<p><strong>YouTube</strong> made Web video workable. No such service existed to popularize the use of audio in webpages. On the contrary, Napster.com and iTunes focused attention on downloadable music applications. Wouldn&#8217;t it be great if there was an easy way to incorporate sounds on a webpage for other purposes. Good News! There is. All major browsers now support basic HTML5 audio with the notable exception of Internet Explorer.</p>
<h3>The HTML5 Audio Solution</h3>
<p>HTML5 audio consists of the <i>audio</i> element and a JavaScript API for playing the sound it represents. The element is a container (it has both opening and closing tags) and what&#8217;s inside is fallback content for legacy browsers and search-bots. It can be written simply as: </p>
<pre style="color: #090; font-size: small;">
&lt;audio src="<i>url</i>" autoplay loop&gt;
        Aw, snap. Your browser doesn't support HTML5 audio!
&lt;/audio&gt;
</pre>
<p>The above would be perfect for playing background music on a webpage. it could be placed anywhere in the body of the document&mdash;heard but not seen. For creating a controllable audio player, the <i>controls</i> attribute can be added to the opening tag.</p>
<pre style="color: #090; font-size: small;">
&lt;audio src="<i>url</i>" controls&gt;
        &lt;a href="<i>url</i>"&gt;Download the audio file&lt;/a&gt;
&lt;/audio&gt;
</pre>
<p>Which, depending on your browser will create a player like one of these:*</p>
<table cellspacing="0" style="margin: 1em auto;">
<tr>
<td style="text-align:right">IE</td>
<td>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Download the audio file</a></td>
</tr>
<tr>
<td style="text-align:right">Firefox</td>
<td><img src="http://larryaronson.com/wp-content/uploads/firefox_audio.gif" alt="Firefox audio controls" title="firefox_audio" width="321" height="56" class="alignnone size-full wp-image-1700" /></td>
</tr>
<tr>
<td style="text-align:right">Safari</td>
<td><img src="http://larryaronson.com/wp-content/uploads/safari_audio.gif" alt="Safari audio controls" title="safari_audio" width="217" height="41" class="alignnone size-full wp-image-1701" /></td>
</tr>
<tr>
<td style="text-align:right">Chrome</td>
<td><img src="http://larryaronson.com/wp-content/uploads/chrome_audio.gif" alt="Chrome audio controls" title="chrome_audio" width="314" height="47" class="alignnone size-full wp-image-1699" /></td>
</tr>
<tr>
<td style="text-align:right">Opera</td>
<td><img src="http://larryaronson.com/wp-content/uploads/opera_audio.gif" alt="Opera Audio controls" title="opera_audio" width="312" height="36" class="alignnone size-full wp-image-1727" /></td>
</tr>
</table>
<p><span style="font-size: x-small">(* Just pictures of the controls in different browsers. They don&#8217;t work here; neither does the link.)</span></p>
<p>Unfortunately, because of the differing support among browsers for the three file types, this approach won&#8217;t work in all browsers. That means having at least mp3 and ogg audio file versions and using browser detection to figure out which to load. </p>
<p>But wait. There&#8217;s an alternate form of the audio element that takes a different approach: try one format and, if it doesn&#8217;t work, try another. You still need at least two files but the syntax is much simpler.</p>
<pre style="color: #090; font-size: small;">
&lt;audio id="bgSound" loop&gt;
        &lt;source src="audio/bgSound.mp3" type="audio/mp3" /&gt;
        &lt;source src="audio/bgSound.ogg" type="audio/ogg" /&gt;
        &lt;-- <i>lnsert fallback Flash Player code here</i> --"&gt;
&lt;/audio&gt;
</pre>
<p>The audio element must be in the body of the html document. I&#8217;ve given an <i>id</i> attribute to the above so it can be referred to by JavaScript statements. Place a script element right after the audio element to get its DOM object:</p>
<pre style="color: #090; font-size: small;">
&lt;script type="text/javascript"&gt;
  var bgSound = document.getElementById('bgSound');
&lt;/script&gt;
</pre>
<p>Don&#8217;t put the JavaScript in the head of the document, the audio element must be defined before its DOM object can be referenced. The DOM object for the audio allows you to change its properties, start and stop the music. To play the audio as page background, add an <i>onload</i> attribute to the body tag:</dt>
<pre style="color: #090; font-size: small;">
&lt;body onload="bgSound.play();"&gt;
</pre>
<p>As an alternative, use jQuery in the document head to call the play method at document ready time (when all the HTML is parsed but images may still be loading.)</p>
<pre style="color: #090; font-size: small;">
&lt;script type="text/javascript"&gt;
  $(document).ready( function () {$('#bgSound').play();} );
&lt;/script&gt;
</pre>
<p>The jQuery <i>$</i> function is similar to JavaScript&#8217;s <i>getElementById( )</i> method. You&#8217;ll need the jQuery library for this to work. If it isn&#8217;t already loaded, placing the following script element in the document head will get it from Google.</p>
<pre style="color: #090; font-size: small;">
&lt;script type="text/javascript"
 src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt;
&lt;/script&gt;
</pre>
<p>To play a sound effect when the user&#8217;s mouse is over a link, remove the <i>loop</i> attribute from the audio tag and add <i>preload</i>, then use the <i>onmouseover</i> attribute in the link. You can get the DOM object and play it in one move:</p>
<pre style="color: #090; font-size: small;">
&lt;audio id="thanks" preload&gt;
        &lt;source src="audio/thanks.mp3" type="audio/mpeg" /&gt;
        &lt;source src="audio/thanks.ogg" type="audio/ogg" /&gt;
&lt;/audio&gt; 

&lt;a href="javascript:void(0);"
   onmouseover="document.getElementById('thanks').play();"&gt;A shout out&lt;/a&gt;
</pre>
<p>Or, to assign a sound to a button like the one at the bottom of this post</p>
<pre style="color: #090; font-size: small;">
&lt;audio id="ella" preload&gt;
        &lt;source src="audio/swonderful.mp3" type="audio/mpeg" /&gt;
        &lt;source src="audio/swonderful.ogg" type="audio/ogg" /&gt;
&lt;/audio&gt;

&lt;button onclick="document.getElementById('ella').play()"&gt;
        I like it!
&lt;/button&gt;
</pre>
<p>The JavaScript API for HTML5 Media elements contains many more properties and features including a <i>track</i> property which can be used to segment a file into separate sounds of different durations. One audio element could be used to (pre)load dozens of different sound effects for a website. Not all advanced API features will be supported by all browsers in the near future, but eventually, using sound on a website will become as natural and as easy to do as using images.</p>
<p><a href="javascript:void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" onmouseover="document.getElementById('thanks').play();">A shout out</a> to my friends at <a href="http://www.facebook.com/home.php?sk=group_171764366167976&#038;ap=1" target="_blank">WWWAC</a> who helped test HTML5 Audio on the IE9 beta release.</p>
<p>What do you think of HTML Audio? &nbsp;&nbsp; <button onclick="document.getElementById('ella').play()">I like it!</button></p>
<hr size="1" />
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2010/understanding-html5-audio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://larryaronson.com/wp-content/uploads/swonderful.ogg" length="68391" type="audio/ogg" />
<enclosure url="http://larryaronson.com/wp-content/uploads/swonderful.mp3" length="61930" type="audio/mpeg" />
<enclosure url="http://larryaronson.com/wp-content/uploads/thanks.ogg" length="16357" type="audio/ogg" />
<enclosure url="http://larryaronson.com/wp-content/uploads/thanks.mp3" length="17635" type="audio/mpeg" />
		</item>
		<item>
		<title>Editable Content and Local Storage in HTML5</title>
		<link>http://larryaronson.com/2010/editable-content-and-local-storage-in-html5/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2010/editable-content-and-local-storage-in-html5/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 19:32:45 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[contenteditable]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[notepad]]></category>
		<category><![CDATA[webstorage]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1247</guid>
		<description><![CDATA[A demo showing how to build a <em>Notepad</em> widget using new HTML5 features: content editable, and webstorage. The Notepad provides the ability to keep a list of private notes associated with a webpage.  ]]></description>
			<content:encoded><![CDATA[<p>A lot of the noise around HTML5 has been about whether or not it will replace Flash as the primary means of delivering video content over the Web. While I believe that HTML5&#8242;s simple, native <em>video</em> element is superior to Flash&#8217;s plugin-based mess of <em>object, embed </em>and<em> param</em> elements, Flash isn&#8217;t going away anytime soon. The noise, however, drowns out information about other interesting HTML5 features, two of which, content editable-ness and local storage, I&#8217;ll explore in this article with a simple example. Google&#8217;s Chrome browser supports both of these features; other browsers support one or the other, or neither.</p>
<p><img src="http://larryaronson.com/wp-content/uploads/imgres.jpeg" alt="Local Storage" title="Open Container" width="259" height="194" class="alignleft size-full wp-image-1287" />Let&#8217;s say you have a page on your website and you would like to offer your readers the ability to jot down notes related to the content of that page in some kind of input field. Furthermore, since you expect visitors to revisit the page from time to time, you&#8217;d like to store their notes somewhere so that the input field can be loaded when they next load the page. Before HTML5, you would either use a server-side process, cookies or some combination of the two to make this happen. With HTML5, there&#8217;s a third choice: the <em>localStorage</em> window object.</p>
<p>First, let&#8217;s start with the input field. We could use a <em>textarea</em> element but in HTML5, any element can be turned into an input element by adding the <em>contenteditable</em> attribute:</p>
<pre style="color:#007f00">
&lt;ul id="notepad" contenteditable="true">
  &lt;li>&lt;/li>
&lt;/ul>
</pre>
<p>In the  CSS for this list element, we want to set its size and position:</p>
<pre style="color:#007f00">#notepad {
 height: 20%;
 width: 20%;
 display: none;
 position: fixed;
 top: 0.5in; right: 0.5in;
 overflow: auto;
 padding: 1em;
 border: thin solid;
 list-style-type: none;
 background-color: #fffff0; /* light yellow */
}</pre>
<p>This will place the list element 1/2 inch down and in from the top-right corner of the browser&#8217;s window. The bordered box will take up 1/5 of the window&#8217;s width and height and scrolling will be enabled if there is more content then fits. The <em>display</em> property is set to &#8220;none&#8221; initially. The user will be able to make the notepad list visible by clicking a button with an <em>onclick</em> handler.</p>
<pre style="color:#007f00">&lt;button id="notepad_toggle"
        onclick="$('#notepad').toggle()">Notepad&lt;/button></pre>
<p>I&#8217;m using jQuery for the <em>onclick </em>handler because it makes it easy to target elements<em> </em>. If you copy this code, make sure you load jQuery somewhere in the document&#8217;s head.</p>
<p>HTML5 extends the <em>window</em> object with the <em>localStorage</em> property and two primary methods: <em>setItem(name, value)</em> and <em>getItem(name)</em> to set and retrieve name/value pairs of data items. Any number of such items can be stored with a webpage and each page&#8217;s storage object is independent of any other page&#8217;s. Unlike cookies, local storage items are never sent by the browser to the server and thus provides a efficient means of saving page state information even for megabyte data items.</p>
<p>For our example, we can store the contents of the notepad element each time it is changed. We will do this with the blur method, detecting when the user leaves the notepad to do something else. Here&#8217;s some jQuery that does that nicely:</p>
<pre style="color:#007f00">$('#notepad').blur(function () {
  localStorage.setItem('notepad', this.innerHTML);
});</pre>
<p>How nice is that? The storage doesn&#8217;t have to be initialized; it&#8217;s just there waiting for you to throw something into it.  </p>
<p>When the page is first loaded we need to check if the notepad contents has been saved from some previous visit by this browser and if so, use the stored value to replace the inner contents of the list. This can be done with the following JavaScript statement:</p>
<pre style="color:#007f00">  if ( localStorage.getItem('notepad') ) {
    var notepad = document.getElementById('notepad');
    notepad.innerHTML = localStorage.getItem('notepad');
  }</pre>
<p>Note that there&#8217;s no conflict in the three uses of &#8216;notepad&#8217; in the code above. The name for the local variable can be anything as can the name of the stored data item. Neither has to be the same as the UL element&#8217;s ID. Hopefully, I&#8217;m avoiding confusion by naming everything &#8216;notepad&#8217; and not adding any.</p>
<p>Since this is only going to work on some browsers, let&#8217;s test to see if local storage is available. If it isn&#8217;t,  we can just hide the the button that makes the notepad visible.</p>
<pre style="color:#007f00">if (!window.localStorage) $('#notepad_toggle').hide();</pre>
<p>or, for debugging, we can call an <em>alert</em> message.</p>
<p>All of the code can go into a script element embedded in the content body, like this blog post, for example:</p>
<p><button id="notepad_toggle" onclick="$('#notepad').toggle('slow')" style="padding: 0.5em;">Notepad</button><br />
<script type="text/javascript">$(document).ready(function () { if ( window.localStorage ) { if ( localStorage.getItem('notepad') ) { var notepad = document.getElementById('notepad'); notepad.innerHTML = localStorage.getItem('notepad'); } $('#notepad').blur(function () { setItem('notepad', this.innerHTML); }); } else { $('#notepad_toggle').hide(); } });</script></p>
<p>Click the button above and enter anything in the light yellow notepad that opens in the top right corner of your HTML5 capable browser.  Enter anything you want – I&#8217;ll never see it, nor will anyone else. What&#8217;s entered in your local storage stays in your local storage. Try dragging and dropping images, tables, links and other thingys. Notice something interesting? You can&#8217;t use HTML to markup your own typing but anything you drag or paste in retains all of its HTML formatting. Now Go Away! Come back to this page sometime later (with the same browser) and click the notepad button again. There&#8217;s your stuff!  </p>
<p><a href="javascript:void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" onclick="$('#localStorage_code').slideDown('slow')">Click here to see the code</a> for a stand-alone demo to get you started.</p>
<div id="localStorage_code" style="display:none;">
<pre style="font-size: 11px; color:#007f00">
&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;Notepad Demo&lt;/title&gt;
&lt;!-- (c) 2010 by Larry Aronson --&gt;
&lt;style&gt;
    body  { padding: 36px; }
    #notepad {
     height: 20%;
     width: 20%;
     display: none;
     position: fixed;
     top: 0.5in; right: 0.5in;
     overflow: auto;
     padding: 1em;
     border: thin solid;
     list-style-type: none;
     background-color: #fffff0; /* light yellow */
    }
&lt;/style&gt;

&lt;!-- let's get our jQuery from Google --&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"&gt;
&lt;/script&gt;
&lt;script&gt;
    $(document).ready(function () {
      if ( window.localStorage ) { 	// see if webstorage is working
        if ( localStorage.getItem('notepad') ) {
          var notepad = document.getElementById('notepad');
          notepad.innerHTML = localStorage.getItem('notepad');
        }
        $('#notepad').blur(function () {	// save when exiting the notepad
          localStorage.setItem('notepad', this.innerHTML);
        });
      }
      else {
        $('#notepad_toggle').hide(); 	// hide button if no webstorage
      }
    });
&lt;/script&gt;
&lt;/head&gt;  

&lt;body&gt;
  &lt;button id="notepad_toggle"
  	  onclick="$('#notepad').toggle('slow')"&gt;Notepad&lt;/button&gt;
&lt;ul id="notepad" contenteditable="true"&gt;
&lt;li&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
</div>
<ul id="notepad" contenteditable="true" style="height: 20%; width: 20%; display: none; position: fixed; top: 0.5in; right: 0.5in; overflow: auto; padding: 1em; border: thin solid; list-style-type: none; background-color: #fffff0;">
<li> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2010/editable-content-and-local-storage-in-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding more content with less clutter</title>
		<link>http://larryaronson.com/2009/adding-more-content-with-less-clutter/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2009/adding-more-content-with-less-clutter/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 21:46:47 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Advanced Tooltips]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[random quotes]]></category>
		<category><![CDATA[UI Tools]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=990</guid>
		<description><![CDATA[<a href="adding-more-content-with-less-clutter"><img width="75" height="75" src="http://larryaronson.com/wp-content/uploads/Kate-Nasser.png" alt="" class="alignleft wp-image-1047" /></a>For my client Kate Nasser's website, I made a number of changes to add more features &#38; content, reduce clutter and improve search engine optimization (SEO). This article shows how to use advanced tooltips to make suplimental information invisible until needed. ]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a fundamental conflict in web page design between content and clutter. We want more content to make our pages findable &amp; provide value to visitors while maintaining visually clear layouts so as not to frighten away seekers of simple truths. The key to solving this conundrum is to stop thinking of web pages as printed page emulators. A printed page is a fixed matrix of tiny colored dots (pixels) on a two-dimensional surface. A web page is a dynamic document object composed of multiple layers of interactive elements.</p>
<p><img id="kn1" class="alignright" src="http://katenasser.com/wp-content/themes/katenasser/screenshot.jpg" alt="" width="200" height="213" title="Kate Nasser's front page as of November, 2009" />My client, Kate Nasser – the people skills coach, has grown her consulting business by consistently adding content to her blog/website and by using <a href="http://twitter.com/katenasser">Twitter</a>, <a href="http://linkedin.com">LinkedIn</a> and <a href="http://www.youtube.com/user/KateNasser">youTube</a> to draw traffic. A recent SEO/SEM assessment of her site recommended adding more keyword-rich content and reducing some of front page&#8217;s  clutter.  This is what the page looked liked.</p>
<h3>Advanced Tooltips.</h3>
<p>We had a box on the right side of the content area listing a dozen &#8220;Needs&#8221; linked to different site pages or posts. With each need there was an associated comment (technically, a definition list.) We decided to move the box to the left side of the page (ahead of the straight text content,) placing the comment parts in tooltip boxes that appear as you mouse over the topic part. Kate was free to add more content to the hidden (only from humans) comment parts.</p>
<p>Tooltips are the little yellow boxes that appear when your mouse hovers over a link. The content of the tooltip box is taken from the title attribute of the HTML tag that creates the link. But ordinary tooltips are boring with fixed style and color; yellow wasn&#8217;t the best choice given the site&#8217;s aqua tones.</p>
<p>So, I installed <a href="http://flowplayer.org/tools/" target="_blank">JQuery Tools from Flowplayer.org</a> which has an easy to use, advanced tooltip tool. JQuery is a library of Javascript functions that make it easy to add dynamic behavior to Web page elements without having to worry about cross-browser incompatibilities. JQuery Tools is a free, lightweight tool collection that provides basic behaviors to attach to any page element. The Advanced Tooltip tool replaces the browser&#8217;s builtin tooltip and can be attached to any page element, not just links.</p>
<p>To make Advanced Tooltips work, you have to provide a page element with a unique id to hold the content. It doesn&#8217;t matter where it&#8217;s placed. The element, typically a division, is dynamically positioned near the moused-over element. The element is re-useable; you only need one holder element for all tooltips of a given style on a page. The tooltip is styled using Normal CSS so I was able to match the colors and typography of that section of the site&#8217;s front page.</p>
<h4 id="kn2" title="Click &lt;em&gt;expand&lt;/em&gt; to display the technical details of using advanced tooltips.  The &lt;em&gt;close&lt;/em&gt; link is at the end of the section.">Technical Details <small>(<a onclick="$('#TechDetails').slideDown();" href="javascript:void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Expand</a>)</small></h4>
<div id="TechDetails" style="display:none; color:#666; font-size: 90%;">
<p>On KateNasser.com&#8217;s front page (id=2,) tooltips will be activated for all links that are inside level 3 headings in the css class, <em>need-title</em>. This bit of <span style="color: #993300;">HTML</span>, <span style="color: #008000;">PHP</span> and <span style="color: #0000ff;">jQuery</span> coding was added to the document head in the header template.</p>
<pre id="line21" class="SmallCode"><span style="color: #993300;">&lt;script src="http://cdn.jquerytools.org/1.1.2/jquery.tools.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;</span><span style="color: #008000;">
&lt;?php if (is_page("2")) { ?&gt;</span>
<span style="color: #0000ff;">    $(document).ready(function() {
        $("h3.need-title a").tooltip({ tip: "#TipBox",
                                       offset: [-25, 150],
                                       effect: 'fade' });
    });</span><span style="color: #008000;">
&lt;?php } ?&gt;</span>
<span style="color: #993300;">&lt;/script&gt;</span></pre>
<p>The first line brings in the jQuerytools library, including the latest version of jQuery. Flowplayer.org encourages developers to directly link to their high-performance server to get the latest version. However, you can also download the library and install in on your own site for more control.</p>
<p>The <span style="color: #008000;">PHP</span> code makes sure that the tooltip code is executed only on the page we want it to. And, the <span style="color: #0000ff;">jQuery</span> code attaches the tooltips to their triggers and provides some options. JQuery does this after the document is fully defined and &#8220;ready&#8221;. This is typical of jQuery usage.</p>
<p>The holding container is defined in <span style="color: #993300;">HTML</span> at the end of content using the WordPress editor. All it contains is a non-breaking space. Note how the jQuery code above refers to this element using a CSS selector syntax.</p>
<pre id="line314" class="SmallCode"><span style="color: #993300;">&lt;div id="TipBox" class="needs-tips"&gt;&amp;nbsp;&lt;/div&gt;</span></pre>
<p>Finally, in the template style sheet, <em>styles.php</em>, the following <span style="color: #800080;">CSS</span> style rules are used:</p>
<pre class="SmallCode"><span style="color: #800080;">#TipBox {
 display:none;
 width: 200px;
}</span></pre>
<pre class="SmallCode"><span style="color: #800080;">.needs-tips {
 text-align: left;
 background-color: #fafcfb;
 border: 2px solid #009ea0;
 font: italic 10pt comic sans ms;
 color: #000;
 padding: 3px 8px;
}
</span></pre>
<p align="right" id="kn3" title="This expand/collapse behavior is another example of jQuery UI tools.">(<a onclick="$('#TechDetails').slideUp();" href="javascript:void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Close</a>)</p>
<hr size="1" /></div>
<h3>Random Quotes</h3>
<p>Kate has a bunch of her own quotes and was updating her front page every few days with a new quote from the collection. She asked if there were some way to automate the process. I browsed the various code and plugin collections and found noting simple or suitable. I decided to write my own.</p>
<p><a href="http://katenasser.com"><img id="kn4" title="This is Kate Nasser's new front page with more content and less clutter." src="http://larryaronson.com/wp-content/uploads/Kate-Nasser.png" alt="" title="Kate Nasser" width="200" height="220" class="alignleft size-full wp-image-1047" /></a>I copied her front page as a new draft page and cloned the default page template and assigned it to the new page. Thus, I was able to work on and test the new features without endangering the site&#8217;s current front page.  The cloned template would contain custom code to randomly pick a quote and place it at the beginning of the content area. The quotes themselves would be stored (and editable) as custom fields for that page with the key, &#8220;quote&#8221;.</p>
<pre class="SmallCode"><span style="color: #008000;">&lt;?php
    $todaysquote = '';
    $quotes = get_post_meta('2', 'quote');
    if (!empty($quotes)) {
        $todaysquote = $quotes[rand(0, sizeof($quotes) - 1)];
    }
?&gt;
</span><span style="color: #993300;">&lt;div class="dailyquote"&gt;&amp;ldquo;</span><span style="color: #008000;">&lt;?php _e($todaysquote); ?&gt;</span><span style="color: #993300;">&amp;rdquo;
&lt;span&gt;&amp;mdash;</span>Kate Nasser<span style="color: #993300;">&lt;/span&gt;&lt;/div&gt;</span></pre>
<p>First, a <span style="color: #008000;">PHP</span> variable, <em>$todaysquote</em>, is initialized. Then the WordPress function, <em>get_post_meta()</em>, gets all custom fields from post number 2 (that&#8217;s the front page) with key = &#8216;quote&#8217;. The values are returned as an array of strings and assigned to the variable, <em>$quotes</em>. If it&#8217;s not empty, the built-in, PHP random number generator picks one of its array items. Finally, the last two lines define the <span style="color: #800000;">HTML</span> division element that will hold the quote,  enclosing it in smart quote marks and adding Kate&#8217;s signature. Note the use of the special echo function,  <em>_e($todaysquote)</em>,  to encode any HTML characters that might be in the quote string.</p>
<p>One of the upsides of this technique is that a new front page is seen in most every visit to the front page including those by search engine robots. Over time, this can expand the number of keywords associated with the page. Unfortunately, there&#8217;s no easy way to measure which quotes work best. If you do add random content like this to a page, you should check to see if you have a caching plug-in active. You might want to exclude that page from the cache.</p>
<p>I added this feature as a template hack because my client only wanted it on one page which already had a customized template. It could be easily generalized and added as a filter to the theme&#8217;s functions file, for example, to append a random quote to post content when generating a single-post view.</p>
<div id="knTips" style="width:30%; border: 2px solid #900; background-color: #f6f6fc; color: #306; margin: 1em; padding: 1em; font-size: 90%;">&nbsp;</div>
<p><script type="text/javascript">$("#kn1,#kn2,#kn3,#kn4").tooltip({ tip: "#knTips", offset: [-25, -75] });</script></p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2009/adding-more-content-with-less-clutter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

