<?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>Rey Bango &#187; JavaScript</title>
	<atom:link href="http://blog.reybango.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.reybango.com</link>
	<description>JavaScript, HTML, CSS &#38; Random Stuff...</description>
	<lastBuildDate>Wed, 09 May 2012 03:16:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iOS to IE10 Metro: Building Cross-Browser Plugin-Free Experiences</title>
		<link>http://blog.reybango.com/2012/04/09/ios-to-ie10-metro-building-cross-browser-plugin-free-experiences/</link>
		<comments>http://blog.reybango.com/2012/04/09/ios-to-ie10-metro-building-cross-browser-plugin-free-experiences/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 16:35:50 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1843</guid>
		<description><![CDATA[I&#8217;ve had the good fortune of working with my friend Jonathan Sampson recently on figuring out how to help developers build plugin-free experiences. With IE10 Metro going plugin-free, it&#8217;s incredibly important to document steps to help developers provide their users with great experiences without the need for proprietary 3rd party add-ons. If you’ve built a [...]
Related posts:<ol>
<li><a href='http://blog.reybango.com/2012/01/09/fix-common-ie-problems-update-your-docmode-for-web-standards/' rel='bookmark' title='Fix Common IE Problems: Update your Docmode for Web Standards'>Fix Common IE Problems: Update your Docmode for Web Standards</a> <small>Document compatibility defines how a browser renders your website. The...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had the good fortune of working with my friend <a href="https://twitter.com/#!/jonathansampson">Jonathan Sampson</a> recently on figuring out how to help developers build plugin-free experiences. With IE10 Metro going plugin-free, it&#8217;s incredibly important to document steps to help developers provide their users with great experiences without the need for proprietary 3rd party add-ons.</p>
<p>If you’ve built a plug-in-free browsing experience for the iPad, a few changes will make it ready for the new <a href="http://blogs.msdn.com/b/ie/archive/2011/08/31/browsing-without-plug-ins.aspx">IE10 plug-in-free experience</a> on Windows 8. As more browsers adopt the plug-in-free approach, now is a good time to start thinking about it. I’ll show you how to do this in a few steps below by writing code that works well in all modern browsers.</p>
<p>Today we’re going to work with a <a href="http://www.msnbc.msn.com/id/22825103/vp/46802160">MSNBC plug-in-free experience</a> for rich media. It breaks down to two things: styles and scripts. </p>
<p>To modify the files of MSNBC, I will be using a proxy application known as Fiddler. You can download this tool from <a href="http://fiddler2.com">http://fiddler2.com</a>. This tool allows me to modify remote files as though they were on my local machine. If you have direct access to your own site, you can ignore Fiddler, and work directly with your files. Fiddler provides a great way for testing changes without the risk of breaking your live site.</p>
<h2>Step 1: Declare Standards mode and valid markup for modern browsers</h2>
<p>In order to use the HTML5 elements we’ll be utilizing below, you’ll first need to ensure that you are operating in standards mode. One way to ensure this is to include the HTML5 doctype at the top of your document:</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE html&gt;</pre>
<h2>Step 2: Update your CSS vendor prefixes</h2>
<p>The CSS language is constantly in a state of change as new features are suggested, updated, and standardized. In order to allow developers to learn how to use these new features, browser vendors typically offer experimental implementations via prefixed properties.</p>
<p>A key part of using vendor prefixes responsibly is to ensure that prefixes from each vendor are included in your site to allow for the broadest level of feature support. In many cases, especially when building an iPad-centric site, you may have focused solely on <em>-webkit</em> properties, omitting the prefixes which target other browsers such as <em>-o, -ms, and -moz</em>. The end result of this is that you greatly limit the target devices that can render your plugin-free site to as well as provide a degraded experience for users of other modern browsers, many of which could serve up equally engaging functionality.</p>
<p>For instance, we find the following <a href="http://www.msnbc.msn.com/id/45230852/a12">on MSNBC</a>:</p>
<pre class="brush: css; title: ; notranslate">background: -webkit-gradient(
  linear,
  left top,
  left bottom,
  color-stop(1, rgba(192,192,192,.6)),
  color-stop(0.5, rgba(0,0,0,.6))
);</pre>
<p>With the growing trend towards an HTML5 plugin-free experience, it’s important to expand these rules to provide the vendor prefixes of other major browsers as well. </p>
<pre class="brush: css; title: ; notranslate">background: -webkit-linear-gradient(
  top, rgba( 0, 0, 0, 0.0 ) 0%, rgba( 0, 0, 0, 0.6 ) 50% );
background: -moz-linear-gradient(
  top, rgba( 0, 0, 0, 0.0 ) 0%, rgba( 0, 0, 0, 0.6 ) 50% );
background: -ms-linear-gradient(
  top, rgba( 0, 0, 0, 0.0 ) 0%, rgba( 0, 0, 0, 0.6 ) 50% );
background: -o-linear-gradient(
  top, rgba( 0, 0, 0, 0.0 ) 0%, rgba( 0, 0, 0, 0.6 ) 50% );
background: linear-gradient(
  top, rgba( 0, 0, 0, 0.0 ) 0%, rgba( 0, 0, 0, 0.6 ) 50% );</pre>
<p>While more verbose but the benefits to broad browser feature support certainly outweigh the extra typing involved. In addition, there are a number of great tools that can break down this workload, such as <a href="http://sass-lang.com/">SASS</a> and <a href="http://compass-style.org/">Compass</a>, <a href="http://leaverou.github.com/prefixfree/">-prefix-free</a>, or even <a href="http://www.asp.net/web-forms/videos/visual-studio-vnext/visual-studio-vnext-videos-css-editor-snippets">CSS Snippets</a> in the upcoming Visual Studio 2011.</p>
<p>Also, if you’re working predominantly in JavaScript and would like to save time determining which features are supported by your client’s browser, review the instructions in <a href="http://blogs.msdn.com/b/ie/archive/2011/10/28/a-best-practice-for-programming-with-vendor-prefixes.aspx">A Best Practice for Programming with Vendor Prefixes</a> on the IEBlog.</p>
<h2>Step 3: Get rid of browser sniffing methods</h2>
<p>There are two methods used to determine what the user’s browser and device are capable of. One method, which unfortunately is somewhat popular, is <em>browser sniffing</em>. This method consists of examining the navigator object for certain patterns or values.</p>
<pre class="brush: jscript; title: ; notranslate">if ( navigator.userAgent.indexOf(&quot;iPad&quot;) &gt; -1 ) {
  // Load HTML5 Experience
} else {
  // Load Flash Experience
}</pre>
<p>The above code looks at the user agent string for the value “iPad”, and if found delivers a plug-in-free HTML5 experience. Otherwise, it’s assumed you are on a device that has Flash installed. This will result in a broken experience for non-iPad users who are browsing with plug-ins disabled, even though their browser is capable of handling HTML5 features.</p>
<p>Here is an attempt to find the version of Internet Explorer. </p>
<pre class="brush: jscript; title: ; notranslate">if ( tests.IE ) {
  j = /msie.(\d\.\d+)/i;
  k = navigator.userAgent.match(j)[1];
}</pre>
<p>The user agent string is tested for a pattern that attempts to target the version number. This pattern looks for a single digit, followed by a period, followed by any number of additional digits. While this test will find values like “MSIE 8.0” and “MSIE 9.0”, it will not identify the latest version of Internet Explorer, which identifies itself as “MSIE 10.0”, since only one digit is expected before the period.</p>
<p>These are just a couple examples of why browser sniffing is not a best practice. The user agent string is not immutable &#8211; it is a read-write value that is easily changed by plugins, or even the user. Most modern browsers include the ability to easily change this value from their development tools, which some users take advantage of to get around poorly-developed websites.</p>
<p>If we disable plugins, or visit MSNBC from a device/browser that doesn’t have Flash, we would expect it to attempt a plug-in-free experience. Unfortunately, this is not the case. Rather than seeing an HTML5 experience, we’re instead asked to download Flash. This is because the site puts the user in one of two categories: an iPad user, or a Flash-enabled user.</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2012/04/get-flash.png"><img src="http://blog.reybango.com/wp-content/uploads/2012/04/get-flash-300x225.png" alt="" title="get-flash" width="300" height="225" class="alignleft size-medium wp-image-1854" /></a></p>
<h2>Feature Detection</h2>
<p>Rather than trying to guess what a browser is capable of by sniffing its user agent string (which will fail you eventually), it is much wiser to actually test features directly in the browser. If you wanted to test the browser’s ability to deliver video and audio via HTML5, you could actually attempt to create these elements via JavaScript, and see if the browser understands them. This practice is called <em>feature detection</em>.</p>
<pre class="brush: jscript; title: ; notranslate">if ( !!document.createElement(“video”).canPlayType  ) {
  // Load HTML5 Video
} else {
  // Load Flash Video
}</pre>
<p>In the above example, we start by testing whether the <em>canPlayType</em> method exists on our newly-created <em>video</em> tag. We’re using double-negation to cast the response to a boolean. If the browser understands what a <em>video</em> element is, the <em>canPlayType</em> method will be present. If the video element is unknown to the browser, the <em>canPlayType</em> method will not exist. If this test passes, we load our HTML5 video. If the test does not pass, we attempt to load Flash. Deeper feature detection could take place here, since Flash may not be on the machine, or may be disabled.</p>
<p>Feature detection is the preferred method of determining what a browser is capable of, since there is no guesswork involved. If the browser passes properly-constructed tests, it absolutely supports the features you would like to use.</p>
<p>Many great tools exist to provide feature tests for you. Once such tool, which provides over 40 tests, is <a href="http://www.modernizr.com/">Modernizr</a>. This tool creates a global object called “<em>Modernizr</em>” which contains the results of your tests. With Modernizr, testing for HTML5 video support is extremely easy:</p>
<pre class="brush: jscript; title: ; notranslate">if ( Modernizr.video ) {
  // Load HTML5 Video
}</pre>
<p>MSNBC engages in browser sniffing to see if the device accessing the page is an iPad or not. Our first step is to remove the browser sniffing code, and replace it with feature detection code. </p>
<p>Before we can modify browser sniffing code, we first need to locate it. While in Internet Explorer, pressing F12 will pull up our <a href="http://msdn.microsoft.com/en-us/library/gg589512(v=vs.85).aspx">Developer Tools</a>. Within the tools, open the Script tab and do a search for “userAgent”. This search will seek out any instance of this property name in all of the site’s script files. We’re interested in the result from line 41 of <a href="http://www.msnbc.msn.com/id/37156949/">http://www.msnbc.msn.com/id/37156949/</a>.</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2012/04/find-userAgent.png"><img src="http://blog.reybango.com/wp-content/uploads/2012/04/find-userAgent-300x225.png" alt="" title="find-userAgent" width="300" height="225" class="alignleft size-medium wp-image-1855" /></a></p>
<p>Now that we know what we want to edit, we can open up Fiddler and load up our traffic. Once Fiddler is opened, perform a hard-refresh (Ctrl+F5 in IE) on the MSNBC page. This results in all of the page sessions being listed in Fiddler.</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2012/04/fiddler-sessions.png"><img src="http://blog.reybango.com/wp-content/uploads/2012/04/fiddler-sessions-300x225.png" alt="" title="fiddler-sessions" width="300" height="225" class="alignleft size-medium wp-image-1858" /></a></p>
<p>Looking carefully, you’ll notice our resource is the third from the top. Next I will setup an <a href="http://fiddler2.com/Fiddler2/help/AutoResponder.asp">AutoResponder</a> for this session file so that anytime it is requested, my own custom file is substituted in the place of the server response:</p>
<ol>
<li>Right-click this session and select “Decode Selected Sessions” from the context menu.</li>
<li>Select the AutoResponder tab on the right.</li>
<li>Click the “Enable automatic responses” checkbox in the AutoResponder tab.</li>
<li>Drag the selected session from the left panel into the AutoResponder tab.</li>
</ol>
<p>At this point, you should have an entry within your AutoResponder tab with the following rules:</p>
<ul>
<li>If URI matches: EXACT:http://www.msnbc.msn.com/id/37156949/</li>
<li>Then respond with: *200-SESSION_3</li>
</ul>
<p>Right-click the entry in the AutoResponder and select <em>Edit Response</em>. In the popup that follows, switch to the SyntaxView tab where we will find the source for this file. As expected, line 41 contains our browser sniffing code:</p>
<pre class="brush: jscript; title: ; notranslate">if(!(navigator.userAgent.toLowerCase().indexOf(&quot;ipad&quot;)&gt;-1)){
  // Flash Experience
}</pre>
<p>Rather than test the contents of the userAgent, we’re going to instead look for support for the HTML5 video tag. Switch the above condition to the following:</p>
<pre class="brush: jscript; title: ; notranslate">if ( !document.createElement(&quot;video&quot;).canPlayType ) {
  // Flash Experience
}</pre>
<p>This test checks to see if we cannot use the video element. If canPlayType comes back as undefined, it will be cast to true and the first code block will be entered, setting up the Flash experience.</p>
<h2>Step 4: Update touch and pointer events</h2>
<p>Safari supports both a touch event model and a mouse event model. Internet Explorer 10 groups touch, mouse, and stylus events into a single abstract item known as a <em>pointer</em>. In fact, Internet Explorer 10 is the first browser to work for all input types, across all devices. This abstraction cuts down drastically on the amount of effort involved to determine which event model you ought to bind to and how to detect user-interaction. This pointer is then handled through MSPointer events. If necessary, you can determine the type of pointer by accessing the <em>pointerType</em> property.</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2012/04/20110920-pointer.png"><img src="http://blog.reybango.com/wp-content/uploads/2012/04/20110920-pointer.png" alt="" title="20110920-pointer" width="264" height="272" class="alignleft size-full wp-image-1859" /></a></p>
<p>Due to the fact Internet Explorer doesn’t support Apple’s proprietary event model, which includes touch events like <em>touchstart, touchmove</em>, and <em>touchend</em>,  MSNBC’s event listeners will need to be amended to listen for <a href="http://msdn.microsoft.com/library/ie/hh673557.aspx#pointer_events">MSPointer events</a> like <em>MSPointerDown, MSPointerUP</em>, and <em>MSPointerMove</em>.</p>
<p>Due to the difference in event model implementations, use a feature detection tool like Modernizr or code like this to target all major event models:</p>
<pre class="brush: jscript; title: ; notranslate">if (window.navigator.msPointerEnabled) {
  myCanvas.addEventListener(&quot;MSPointerMove&quot;, paint, false);
} else {
  myCanvas.addEventListener(&quot;mousemove&quot;, paint, false);
  myCanvas.addEventListener(“touchmove”, paint, false);
}</pre>
<p>MSNBC only supports touch events, which we will need to change so that visitors who happen to be using a mouse can still interact with the page:</p>
<p>Our events are tied up in <a href="http://www.msnbc.msn.com/id/43662671/15">http://www.msnbc.msn.com/id/43662671/15</a>:</p>
<pre class="brush: jscript; title: ; notranslate">document.addEventListener(&quot;touchstart&quot;, touchHandler, false);
document.addEventListener(&quot;touchmove&quot;, touchHandler, false);
document.addEventListener(&quot;touchend&quot;, touchHandler, false);</pre>
<p>We’re going to update this to include the MSPointer events as well:</p>
<pre class="brush: jscript; title: ; notranslate">if (window.navigator.msPointerEnabled) {
  document.addEventListener(&quot;MSPointerDown&quot;, touchHandler, false);
  document.addEventListener(&quot;MSPointerMove&quot;, touchHandler, false);
  document.addEventListener(&quot;MSPointerUp&quot;, touchHandler, false);
} else {
  document.addEventListener(&quot;touchstart&quot;, touchHandler, false);
  document.addEventListener(&quot;touchmove&quot;, touchHandler, false);
  document.addEventListener(&quot;touchend&quot;, touchHandler, false);
  document.addEventListener(&quot;mousedown&quot;, touchHandler, false);
  document.addEventListener(&quot;mousemove&quot;, touchHandler, false);
  document.addEventListener(&quot;mouseup&quot;, touchHandler, false);
}</pre>
<p>First we’re checking for the presence of pointers. Since the MSPointer covers the mouse, fingers, and pens, we don’t need anything else besides them. We fall back, if necessary, to provide both touch and mouse events. </p>
<p>Next we need to create cases for these event types in <a href="http://www.msnbc.com/id/44937131/">http://www.msnbc.com/id/44937131/</a>. Currently, MSNBC starts with the following:</p>
<pre class="brush: jscript; title: ; notranslate">if ( event.type == &quot;touchstart&quot; ) {
  /* Start drag logic */
} else
if ( event.type == &quot;touchmove&quot; ) {
  /* Drag logic */
} else
if ( event.type == &quot;touchend&quot; ) {
  /* Complete drag logic */
}</pre>
<p>We’ll modify this to listen for all of the registered event types:</p>
<pre class="brush: jscript; title: ; notranslate">if ( event.type.match( /(down|start)$/i ) ) {
  /* Start drag logic */
} else
if ( event.type.match( /move$/i ) ) {
  /* Drag logic */
} else
if ( event.type.match( /(up|end)$/i ) ) {
  /* Complete drag logic */
}</pre>
<p>The above uses the match method and a series of regular expressions to determine which event was raised. If the event raised ends with a case-insensitive “down” or “start”, we begin our drag code. If the event ends with a case-insensitive “move”, we perform the actual drag logic itself. And lastly, if the event ends with a case-insensitive “up” or “end”, we end our dragging event. Note: other events may be caught here as well, like <em>onresizeend</em> and <em>keyup</em>. Be sure to consider this in your project.</p>
<p>The above is an implementation of Ted Johnson’s solution in <a href="http://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx">Handling Multi-touch and Mouse Input in All Browsers</a>.</p>
<p>The drag logic itself initially relies upon the <em>event.targetTouches</em> <a href="https://developer.mozilla.org/en/DOM/TouchList">TouchList</a>. This member does not exist in Internet Explorer. The drag logic attempts to gather the <em>pageX</em> and <em>pageY</em> properties from the first item in the <em>TouchList</em>, however in Internet Explorer these values are found directly on the event object.</p>
<pre class="brush: jscript; title: ; notranslate">var curX = event.targetTouches[0].pageX;</pre>
<p>Using the logical OR operator, I instruct curX to hold the value of event.pageX as long as event.pageX is present on the event object. If this property is not found, look within the targetTouches list:</p>
<pre class="brush: jscript; title: ; notranslate">var curX = event.pageX || event.targetTouches[0].pageX;</pre>
<p>If <em>event.pageX</em> is not found, we fall back to assigning the value of <em>targetTouches[0].pageX</em> to our variable.</p>
<p>Another important item to keep in mind is that this site initially responds to <em>touchmove</em>. When this event is raised while touching the playlist, the code attempts to reposition the playlist based upon your touch movement. There is no hovering when it comes to touch &#8211; you’re either touching, or you’re not.</p>
<p>Now that we have mouse events tied into this logic, we have introduced the possibility for hovering. So while touchmove is free to reposition our playlist when it is over the playlist, we don’t want to do the same for mousemove. In fact, we only want the mousemove event to reposition the playlist when the mouse button is pressed.</p>
<p>For further reading, and examples on how to target all browsers, see <a href="http://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx">Handling Multi-touch and Mouse Input in All Browsers</a>.</p>
<h2>Testing both experiences</h2>
<p>Recall our feature detection from earlier, how we first check to see if HTML5 video support is in the user&#8217;s browser. If it is, we give them HTML5. If it is not, we give them Flash. One easy way to test our work is to use a browser, or <a href="http://blogs.msdn.com/b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx">document mode</a>, that doesn’t support HTML5 features. This is very easy to test with Internet Explorer:</p>
<ol>
<li>Press F12 to reveal the Developer Tools</li>
<li>Change your Document Mode to Internet Explorer 7 Standards</li>
<li>Refresh the page</li>
</ol>
<p>If our feature detection condition was written properly, you should now be watching a Flash-based presentation. Switching your Document Mode back into Internet Explorer 9 Standards (or “Standards” if you’re using IE10), will return you to the HTML5 experience.</p>
<h2>Get it Done!</h2>
<p>Hopefully this post helps to define the types of changes that will allow your iOS site to work properly in IE10 Metro and other plugin-free environments. By including best practices such as feature detection and responsibly using vendor prefixes for great new features, you should be able to provide your users a great experience, regardless of which browser or device they’re using.  To assist with testing in other plug-in-free environments, download <a href="http://ie.microsoft.com/testdrive/Info/Downloads/Default.html">Internet Explorer 10</a> (currently available only in the Windows 8 CP) and begin testing today!</p>
<p><strong><em>Update: In the rush to get this post up, I realized that I forgot to thank and give credit to <a href="https://twitter.com/#!/jonathansampson">Jonathan Sampson</a> for helping investigate and write about the great techniques mentioned above. He was a huge help in generating many of these great techniques. Thanks JS!</em></strong></p>
<p>Related posts:<ol>
<li><a href='http://blog.reybango.com/2012/01/09/fix-common-ie-problems-update-your-docmode-for-web-standards/' rel='bookmark' title='Fix Common IE Problems: Update your Docmode for Web Standards'>Fix Common IE Problems: Update your Docmode for Web Standards</a> <small>Document compatibility defines how a browser renders your website. The...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2012/04/09/ios-to-ie10-metro-building-cross-browser-plugin-free-experiences/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Site Pinning: Rotating Overlay Icons for Multiple Service Notifications</title>
		<link>http://blog.reybango.com/2011/10/18/site-pinning-rotating-overlay-icons-for-multiple-service-notifications/</link>
		<comments>http://blog.reybango.com/2011/10/18/site-pinning-rotating-overlay-icons-for-multiple-service-notifications/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 13:00:11 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1759</guid>
		<description><![CDATA[In my last post, I went over how to use IE9′s Site Pinning API to implement overlay icons to enhance user notifications. The demo focused on how to display a numeric icon to indicate when a specific event (e.g.: messages in an inbox) had occurred. Pinned site with overlay icon It&#8217;s a really great way [...]
Related posts:<ol>
<li><a href='http://blog.reybango.com/2011/10/10/using-site-pinning-and-overlay-icons-for-enhanced-user-notifications-and-engagement/' rel='bookmark' title='Using Site Pinning and Overlay Icons for Enhanced User Notifications and Engagement'>Using Site Pinning and Overlay Icons for Enhanced User Notifications and Engagement</a> <small>I was recently doing some testing of IE9&#8242;s Site Pinning...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://blog.reybango.com/2011/10/10/using-site-pinning-and-overlay-icons-for-enhanced-user-notifications-and-engagement/">last post</a>, I went over how to use <a href="http://msdn.microsoft.com/en-us/library/gg491731(v=VS.85).aspx">IE9′s Site Pinning API</a> to implement overlay icons to enhance user notifications. The demo focused on how to display a numeric icon to indicate when a specific event (e.g.: messages in an inbox) had occurred. </p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2011/10/overlay-icon.png"><img src="http://blog.reybango.com/wp-content/uploads/2011/10/overlay-icon.png" alt="" title="overlay-icon" width="508" height="150" class="alignleft size-full wp-image-1710" /></a><br />
<em>Pinned site with overlay icon</em></p>
<p>It&#8217;s a really great way of letting your users know that there&#8217;s pending information for them to check into. But what happens if your site offers multiple types of notifications? With websites offering so much functionality nowadays, it&#8217;s pretty common for them to also serve up multiple types of notifications, from friend requests and event reminders to new messages and game invites.</p>
<h2>Rotating Multiple Overlays Icons</h2>
<p>The great thing about the Site Pinning API is that it&#8217;s very flexible and through some JavaScript magic, you can easily display multiple overlay icons for the various services you have. In this demo, I want to rotate through 3 different overlay icons that alert the user to pending messages, requests and actions.</p>
<p>As before, I had to flex some of my artistic talent by creating the overlay icons using <a href="http://buildmypinnedsite.com/#step_1">the x-icon editor</a>. I created 5 of each and here&#8217;s how the first three look:</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2011/10/messages-1.png"><img src="http://blog.reybango.com/wp-content/uploads/2011/10/messages-1.png" alt="" title="messages-1" width="32" height="32" class="alignleft size-full wp-image-1762" /></a><a href="http://blog.reybango.com/wp-content/uploads/2011/10/requests-1.png"><img src="http://blog.reybango.com/wp-content/uploads/2011/10/requests-1.png" alt="" title="requests-1" width="32" height="32" class="alignleft size-full wp-image-1763" /></a><a href="http://blog.reybango.com/wp-content/uploads/2011/10/actions-1.png"><img src="http://blog.reybango.com/wp-content/uploads/2011/10/actions-1.png" alt="" title="actions-1" width="32" height="32" class="alignleft size-full wp-image-1764" /></a></p>
<p>The code changed slightly from the last demo in order to accommodate multiple bits of data per fetch. While previously, I was only fetching one piece of data, in this demo, I&#8217;m returning 3, one for each notification type:</p>
<pre class="brush: jscript; title: ; notranslate"> myPin.init([{ &quot;data&quot; : [{ &quot;label&quot; : &quot;Messages&quot;, &quot;ntype&quot; : &quot;M&quot;, &quot;num&quot;: 2 }, { &quot;label&quot; : &quot;Requests&quot;, &quot;ntype&quot; : &quot;R&quot;, &quot;num&quot;: 1 }, { &quot;label&quot; : &quot;Actions&quot;, &quot;ntype&quot; : &quot;A&quot;, &quot;num&quot;: 3 }] },
		        { &quot;data&quot; : [{ &quot;label&quot; : &quot;Messages&quot;, &quot;ntype&quot; : &quot;M&quot;, &quot;num&quot;: 1 }, { &quot;label&quot; : &quot;Requests&quot;, &quot;ntype&quot; : &quot;R&quot;, &quot;num&quot;: 5 }, { &quot;label&quot; : &quot;Actions&quot;, &quot;ntype&quot; : &quot;A&quot;, &quot;num&quot;: 2 }] },
		        { &quot;data&quot; : [{ &quot;label&quot; : &quot;Messages&quot;, &quot;ntype&quot; : &quot;M&quot;, &quot;num&quot;: 5 }, { &quot;label&quot; : &quot;Requests&quot;, &quot;ntype&quot; : &quot;R&quot;, &quot;num&quot;: 1 }, { &quot;label&quot; : &quot;Actions&quot;, &quot;ntype&quot; : &quot;A&quot;, &quot;num&quot;: 4 }] }
			   ]);</pre>
<p>As a reminder, the method <em>getData()</em> <strong>simulates</strong> grabbing remote data. So if we look at the data above, we can simulate pulling back three distinct bits of data. This is why we call the method every 10 seconds using setInterval. This allows us to see how notifications might look over a period of time. </p>
<pre class="brush: jscript; title: ; notranslate">setInterval(function () { myPin.getData() }, 10000);</pre>
<p>The next thing that changed is the use of a timer to allow a slight delay while rendering the overlay icons. Using <em>setTimeout()</em> provides enough of delay so that an individual overlay icon is visible to the user before rotating on to the next icon. If we didn&#8217;t have this delay, the rotation would be way too fast to provide any useful notification. If we look at the following image, we can see what the notification will look like:</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2011/10/overlay.png"><img src="http://blog.reybango.com/wp-content/uploads/2011/10/overlay.png" alt="" title="overlay" width="332" height="150" class="alignleft size-full wp-image-1773" /></a><br />
<em>Overlay icon showing numeric notification</em></p>
<p>This is accomplished via the following code:</p>
<pre class="brush: jscript; title: ; notranslate">// Grab the current set of data...
currData = this.dataBin[this.currIndex++].data;		

/* We're going to display a new overlay every x number of seconds to display a new overlay icon so
   let's loop through the data elements for the current set of data... */
for (var i=0; i &lt; currData.length; i++ ){

	(function(idx) { setTimeout( function(){ myPin.dispOverlay( currData[idx] ); }, 1000 * idx); }( i ));					

}</pre>
<p>Here&#8217;s what&#8217;s happening. In the first line, I grab the current set of data that holds all of the notification information (messages, requests &#038; actions). That data looks like this:</p>
<pre class="brush: jscript; title: ; notranslate">[{ &quot;label&quot; : &quot;Messages&quot;, &quot;ntype&quot; : &quot;M&quot;, &quot;num&quot;: 2 },
{ &quot;label&quot; : &quot;Requests&quot;, &quot;ntype&quot; : &quot;R&quot;, &quot;num&quot;: 1 },
{ &quot;label&quot; : &quot;Actions&quot;, &quot;ntype&quot; : &quot;A&quot;, &quot;num&quot;: 3 }]</pre>
<p>I loop through each group of data and assign a timer using <em>setTimeout()</em> that will call <em>dispOverlay()</em> at ~1 second intervals. That&#8217;s the magic code that allows for the gradual icon rendering delay I mentioned before. The expected functionality is that the &#8220;messages&#8221; icon will render followed by the &#8220;requests&#8221; icon 1 second later, and then finally the &#8220;actions&#8221; icon.</p>
<p>Now, you might be wondering why I have an anonymous function wrapping the <em>setTimeout()</em>. It&#8217;s because I have a closure within setTimeout which can <a href="http://james.padolsey.com/javascript/closures-in-javascript/">cause a common scoping issue</a> in which the variable &#8216;i&#8217;, which I use to grab the current index of data, will only be updated to the last index value. James Padolsey has a <a href="http://james.padolsey.com/javascript/closures-in-javascript/">great explanation on it</a> and thanks to <a href="https://twitter.com/jdalton">John David Dalton</a> for helping me troubleshoot this.</p>
<p>The final change is in <em>dispOverlay()</em> in which I need to determine which overlay icon needs to display. Since I now have three different types of notifications, I need a conditional statement to determine the type and build the correct icon name:</p>
<pre class="brush: jscript; title: ; notranslate">if (theData.ntype == &quot;M&quot;) {
	oImg = &quot;images/messages-&quot; + theData.num + &quot;.ico&quot;;
} else if (theData.ntype == &quot;R&quot;) {
	oImg = &quot;images/requests-&quot; + theData.num + &quot;.ico&quot;;
} else if (theData.ntype == &quot;A&quot;) {
	oImg = &quot;images/actions-&quot; + theData.num + &quot;.ico&quot;;
}</pre>
<p>This checks the type and serves up the right icon based on the type and the number of notifications pending for that type.</p>
<h2>The Demo and Final Code</h2>
<p>You can check out the demo by going here in IE9:</p>
<p><a href="http://reybango.com/demos/sprotate/index.html">http://reybango.com/demos/sprotate/index.html</a></p>
<p>When the page renders, drag the tab down to your taskbar and pin it. You should see a new window appear with your newly pinned site. Next, you’ll see the overlay icons appear in the taskbar and they should begin to cycle every 10 seconds.</p>
<p>Here’s the full source code. You can also <a href="reybango.com/demos/sprotate/src/sprotate.zip">download everything here</a>. </p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Pinned Site - Rotating Overlay Icons&lt;/title&gt;
&lt;link rel=&quot;shortcut icon&quot; type=&quot;image/ico&quot; href=&quot;favicon.ico&quot; /&gt;
&lt;meta name=&quot;application-name&quot; content=&quot;Pinned Site Test&quot; /&gt;
&lt;meta name=&quot;msapplication-starturl&quot; content=&quot;http://reybango.com/demos/sprotate/index.html&quot; /&gt;
&lt;meta name=&quot;msapplication-navbutton-color&quot; content=&quot;#3480C0&quot; /&gt;
&lt;meta name=&quot;msapplication-window&quot; content=&quot;width=1024;height=768&quot; /&gt;
&lt;meta name=&quot;msapplication-tooltip&quot; content=&quot;Testing the Pinned Site API&quot; /&gt;
&lt;style&gt;
body {
    background: none repeat scroll 0 0 #4492CE;
    font: 440%/1.4em 'Segoe Light',Segoe,'Segoe UI','Meiryo Regular','Meiryo',sans-serif;
    color: #EDEFF4;
}

&lt;/style&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;div&gt;
&lt;h1&gt;Pinned Sites&lt;/h1&gt;
&lt;p&gt;Rotating Overlay Icons&lt;/p&gt;
&lt;/div&gt;

&lt;script&gt;

	var myData = [];

    var myPin = {

        currIndex: 0,
        dataBin: [],

        getData: function () {

			var idx = 0, currData = [], cntr = 0, theData;

            // Determines whether the current page was launched as a pinned site...
            if (window.external.msIsSiteMode()) {

				// Grab the current set of data...
				currData = this.dataBin[this.currIndex++].data;		

				/* We're going to display a new overlay every x number of seconds to display a new overlay icon so
				   let's loop through the data elements for the current set of data... */
				for (var i=0; i &lt; currData.length; i++ ){

					(function(idx) { setTimeout( function(){ myPin.dispOverlay( currData[idx] ); }, 1e3 * idx); }( i ));					

				}

				if (this.currIndex &gt; 2) { this.currIndex = 0 }

            }

        },

        dispOverlay: function (theData) {

            var oImg = &quot;&quot;;

            // Is there any data?
            if (theData) {

                // Clear any preexisting overlay icon
                window.external.msSiteModeClearIconOverlay();

				// Render the overlay icon based on the data returned...
				if (theData.ntype == &quot;M&quot;) {
					oImg = &quot;images/messages-&quot; + theData.num + &quot;.ico&quot;;
				} else if (theData.ntype == &quot;R&quot;) {
					oImg = &quot;images/requests-&quot; + theData.num + &quot;.ico&quot;;
				} else if (theData.ntype == &quot;A&quot;) {
					oImg = &quot;images/actions-&quot; + theData.num + &quot;.ico&quot;;
				}				

                // Go ahead and create the overlay image and it's label...
                this.setOverlay(oImg, theData.label);

            }

        },

        setOverlay: function (icon, desc) {

            // Sets the overlay icons...
            window.external.msSiteModeSetIconOverlay(icon, desc);
            window.external.msSiteModeActivate();

        },

        init: function (myData) {

            this.dataBin = myData;
			this.getData();

        }

    };

    // This clears out any previously set overlay icons...
    window.external.msSiteModeClearIconOverlay();

    // Run it once to kick everything off...
    myPin.init([{ &quot;data&quot; : [{ &quot;label&quot; : &quot;Messages&quot;, &quot;ntype&quot; : &quot;M&quot;, &quot;num&quot;: 2 }, { &quot;label&quot; : &quot;Requests&quot;, &quot;ntype&quot; : &quot;R&quot;, &quot;num&quot;: 1 }, { &quot;label&quot; : &quot;Actions&quot;, &quot;ntype&quot; : &quot;A&quot;, &quot;num&quot;: 3 }] },
		        { &quot;data&quot; : [{ &quot;label&quot; : &quot;Messages&quot;, &quot;ntype&quot; : &quot;M&quot;, &quot;num&quot;: 1 }, { &quot;label&quot; : &quot;Requests&quot;, &quot;ntype&quot; : &quot;R&quot;, &quot;num&quot;: 5 }, { &quot;label&quot; : &quot;Actions&quot;, &quot;ntype&quot; : &quot;A&quot;, &quot;num&quot;: 2 }] },
		        { &quot;data&quot; : [{ &quot;label&quot; : &quot;Messages&quot;, &quot;ntype&quot; : &quot;M&quot;, &quot;num&quot;: 5 }, { &quot;label&quot; : &quot;Requests&quot;, &quot;ntype&quot; : &quot;R&quot;, &quot;num&quot;: 1 }, { &quot;label&quot; : &quot;Actions&quot;, &quot;ntype&quot; : &quot;A&quot;, &quot;num&quot;: 4 }] }
			   ]);

    // This is only here because I want to simulate pulling data on a regular interval...
    setInterval(function () { myPin.getData() }, 10000);

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Related posts:<ol>
<li><a href='http://blog.reybango.com/2011/10/10/using-site-pinning-and-overlay-icons-for-enhanced-user-notifications-and-engagement/' rel='bookmark' title='Using Site Pinning and Overlay Icons for Enhanced User Notifications and Engagement'>Using Site Pinning and Overlay Icons for Enhanced User Notifications and Engagement</a> <small>I was recently doing some testing of IE9&#8242;s Site Pinning...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2011/10/18/site-pinning-rotating-overlay-icons-for-multiple-service-notifications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Site Pinning and Overlay Icons for Enhanced User Notifications and Engagement</title>
		<link>http://blog.reybango.com/2011/10/10/using-site-pinning-and-overlay-icons-for-enhanced-user-notifications-and-engagement/</link>
		<comments>http://blog.reybango.com/2011/10/10/using-site-pinning-and-overlay-icons-for-enhanced-user-notifications-and-engagement/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 13:00:06 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1707</guid>
		<description><![CDATA[I was recently doing some testing of IE9&#8242;s Site Pinning API and found out about a cool bit of functionality that can enhance user notifications. If you&#8217;re not familiar with site pinning, it&#8217;s a great way to allow users to have easy and quick access to their favorite sites via the Windows taskbar. There&#8217;s a [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I was recently doing some testing of <a href="http://msdn.microsoft.com/en-us/library/gg491731(v=VS.85).aspx">IE9&#8242;s Site Pinning API</a> and found out about a cool bit of functionality that can enhance user notifications. If you&#8217;re not familiar with site pinning, it&#8217;s a great way to allow users to have easy and quick access to their favorite sites via the Windows taskbar. There&#8217;s a really nice <a href="http://www.beautyoftheweb.com/#/productguide/clean/seamless-with-windows-7/pinned-sites">overview on Beauty of the Web</a> that explains how it works.</p>
<h2>Keeping Users Up-to-Date</h2>
<p>One of the features the API provides is the notion of notifications that can allow developers to provide alerts to end users. The functionality allows you to dynamically insert custom overlay icons that can alert users when an important bit of information is available. These overlay icons are rendered over the favicon that is pinned to the taskbar. If you look at the image below, you can see it in action:</p>
<p><img src="http://blog.reybango.com/wp-content/uploads/2011/10/pinned.png" alt="" title="pinned" width="533" height="151" class="alignleft size-full wp-image-1712" /><br />
<em>Pinned site with no overlay icon</em></p>
<p><img src="http://blog.reybango.com/wp-content/uploads/2011/10/overlay-icon.png" alt="" title="overlay-icon" width="533" height="150" class="alignleft size-full wp-image-1710" /><br />
<em>Pinned site with overlay icon</em></p>
<p>So if you think about the possibilities, any site that offers users an inbox, special deals or sends out time-sensitive alerts could use this notification capability to keep their users up-to-date and more engaged on the site. Sites like the Huffington Post have already discovered that users that pinned HuffPost <a href="http://windowsteamblog.com/ie/b/ie/archive/2011/02/17/economics-of-the-web-ie9-users-that-pin-huffington-post-spend-49-more-time-on-site.aspx">spent 49% more time on the site</a>. </p>
<p>The best part is that adding this capability is insanely easy.</p>
<h2>Setting it Up</h2>
<p>For this post, we&#8217;re not going to go into the basics of how to pin a site. If you want to learn more, here&#8217;s a GREAT resource for getting you up to speed quickly: <a href="http://buildmypinnedsite.com/">BuildMyPinnedSite.com</a>. In fact, I used that site to help get me up-to-speed on the basics and it&#8217;s well-worth visiting.</p>
<p>To add notifications, you&#8217;ll need a couple of things:</p>
<ul>
<li>A cool favicon for your site. If you don&#8217;t have one, you can use the handy <a href="http://ie.microsoft.com/testdrive/Browser/IconEditor/Default.html">web-based X-Icon Editor</a> to create one.</li>
<li>A set of overlay icons to use. The recommended size is 16&#215;16.</li>
</ul>
<p>The API is JavaScript-based and we&#8217;ll use the following methods:</p>
<p><em><a href="http://msdn.microsoft.com/en-us/library/ff976301(v=VS.85).aspx">window.external.msSiteModeClearIconOverlay()</a><br />
<a href="http://msdn.microsoft.com/en-us/library/ff976304(v=VS.85).aspx">window.external.msSiteModeSetIconOverlay()</a><br />
<a href="http://msdn.microsoft.com/en-us/library/ff976297(v=VS.85).aspx">window.external.msSiteModeActivate()</a><br />
<a href="http://msdn.microsoft.com/en-us/library/ff976296(v=VS.85).aspx">window.external.msIsSiteMode()</a></em></p>
<p>The <em>window.external.msSiteModeClearIconOverlay</em> method is used to clear out any previously set overlay icons. <em>window.external.msSiteModeSetIconOverlay</em> allows you to specify the name of the notification icon as well as a accessible description. Lastly, we&#8217;ll use <em>window.external.msSiteModeActivate</em> to flash the pinned icon to notify the user of the update. Lastly, <em>window.external.msIsSiteMode</em> will let us know if the page was launched as a pinned site, thus allowing us to better determine when to run the code.</p>
<p>For the overlay icons, I&#8217;m using five images that display numbers 1 through 5 respectively to designate the number of messages are in a user&#8217;s inbox.</p>
<h2>The Code</h2>
<p>The first thing I need to add is the reference to my favicon. Note that if you don&#8217;t add one, then the Internet Explorer&#8217;s icon will be used by default.</p>
<pre class="brush: xml; title: ; notranslate">&lt;link rel=&quot;shortcut icon&quot; type=&quot;image/ico&quot; href=&quot;favicon.ico&quot; /&gt;</pre>
<p>Next, I want to create some sample data to work with. What I want to do for my demo is to have the overlay icon dynamically change every 5 seconds to simulate a more real-world scenario. The data is a simple array containing JSON data in each element.  </p>
<pre class="brush: jscript; title: ; notranslate">myPin.init([{ &quot;num&quot;: 1, &quot;label&quot;: &quot;Label 1&quot; },
                { &quot;num&quot;: 2, &quot;label&quot;: &quot;Label 2&quot; },
                { &quot;num&quot;: 3, &quot;label&quot;: &quot;Label 3&quot; },
                { &quot;num&quot;: 4, &quot;label&quot;: &quot;Label 4&quot; },
                { &quot;num&quot;: 5, &quot;label&quot;: &quot;Label 5&quot; }
                ]);
</pre>
<p>By setting a timer, I&#8217;ll be able to pull a new set of data every 5 seconds. </p>
<pre class="brush: jscript; title: ; notranslate">setInterval(function () { myPin.getData(); }, 5000);</pre>
<p>The main thing to keep in mind is that I&#8217;m &#8220;simulating&#8221; getting data from some remote host. In reality, all that the <em>myPin.getData()</em> method does is use a running counter to grab a new set of data and render a new overlay icon:</p>
<pre class="brush: jscript; title: ; notranslate">getData: function () {
            // A function that just simulates returning a result set...
            var idx = 0;

            // Determines whether the current page was launched as a pinned site.
            if (window.external.msIsSiteMode()) {

                idx = this.currIndex++;
                this.currIndex = (this.currIndex &lt; 5) ? this.currIndex : 0;

                this.dispOverlay(this.dataBin[idx]);

            }

}</pre>
<p>As you can see, it uses the running counter var <em>currIndex</em> to determine which array element to grab and then passes the data to <em>dispOverlay()</em>. This is where we use <em>window.external.msSiteModeClearIconOverlay()</em> to clear out any previously displayed overlay icons and also generate a string for the actual icon name. You can see that the oImg var is created on the fly based on the data we&#8217;re using. </p>
<pre class="brush: jscript; title: ; notranslate">dispOverlay: function (theData) {

            var oImg = &quot;&quot;;

            // Is there any data?
            if (theData) {

                // Clear any preexisting overlay icon
                window.external.msSiteModeClearIconOverlay();

                // Create the image string...
                oImg = &quot;images/num_&quot; + theData.num + &quot;.ico&quot;;

                // Go ahead and create the overlay image and it's label...
                this.setOverlay(oImg, theData.label);

            }

}</pre>
<p>That icon name, along with the accessible label text for the icon, is passed to <em>setOverlay()</em> which sets the overlay icon via <em>window.external.msSiteModeSetIconOverlay</em> and flashes the taskbar icon using <em>window.external.msSiteModeActivate</em>.</p>
<pre class="brush: jscript; title: ; notranslate">setOverlay: function (icon, desc) {

            // Sets the overlay icons...
            window.external.msSiteModeSetIconOverlay(icon, desc);
            window.external.msSiteModeActivate();

}</pre>
<h2>Test it Out</h2>
<p>To test this out, it&#8217;s a simple matter of running your newly pinned page in Internet Explorer 9, grabbing the tab and dragging it down to your taskbar:</p>
<p><img src="http://blog.reybango.com/wp-content/uploads/2011/10/dragged-and-pinned.png" alt="" title="dragged-and-pinned" width="576" height="151" class="alignleft size-full wp-image-1731" /><br />
<em>Tab being dragged to the taskbar</em></p>
<p><img src="http://blog.reybango.com/wp-content/uploads/2011/10/pinned.png" alt="" title="pinned" width="533" height="151" class="alignleft size-full wp-image-1712" /><br />
<em>Pinned site with no overlay icon</em></p>
<p>Five seconds after the page has been pinned, the code will fire off the first notification and continue to cycle through the other icons every subsequent five seconds. </p>
<p><img src="http://blog.reybango.com/wp-content/uploads/2011/10/overlay-icon.png" alt="" title="overlay-icon" width="533" height="150" class="alignleft size-full wp-image-1710" /><br />
<em>Pinned site with overlay icon</em></p>
<p>An important thing to remember is that the <a href="http://msdn.microsoft.com/en-us/library/gg589512(v=VS.85).aspx">IE F12 Developer tools</a> are available to you to use in debugging your pinned site. So if you run into quirks, simply press the F12 key and the tools will appear.</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2011/10/ietools.png"><img src="http://blog.reybango.com/wp-content/uploads/2011/10/ietools-300x225.png" alt="" title="ietools" width="300" height="225" class="alignleft size-medium wp-image-1736" /></a></p>
<h2>The Demo and Final Code</h2>
<p>You can check out the demo I whipped up by going here in IE9:</p>
<p><a href="http://reybango.com/demos/sitepinning/index.html">http://reybango.com/demos/sitepinning/index.html</a></p>
<p>When the page renders, drag the tab down to your taskbar and pin it. You should see a new windows appear with your newly pinned site. Five seconds later, you&#8217;ll see the first overlay icon appear in the taskbar.</p>
<p>Here&#8217;s the full source code. You can also <a href="http://reybango.com/demos/sitepinning/src/pinned-sites-overlay-icons.zip">download everything here</a>. The really great part is that it isn&#8217;t a lot of code to implement this. In fact, to use the API only required 4 method calls. The bulk of the code was to simulate pulling in data. And the <a href="<a href="http://windowsteamblog.com/ie/b/ie/archive/2011/02/17/economics-of-the-web-ie9-users-that-pin-huffington-post-spend-49-more-time-on-site.aspx">&#8220;>impact on user engagement</a> is certainly worth adding in the capability.</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Pinned Site Test&lt;/title&gt;
&lt;link rel=&quot;shortcut icon&quot; type=&quot;image/ico&quot; href=&quot;favicon.ico&quot; /&gt;
&lt;meta name=&quot;application-name&quot; content=&quot;Pinned Site Test&quot; /&gt;
&lt;meta name=&quot;msapplication-starturl&quot; content=&quot;http://reybango.com/demos/sitepinning/index.html&quot; /&gt;
&lt;meta name=&quot;msapplication-navbutton-color&quot; content=&quot;#3480C0&quot; /&gt;
&lt;meta name=&quot;msapplication-window&quot; content=&quot;width=1024;height=768&quot; /&gt;
&lt;meta name=&quot;msapplication-tooltip&quot; content=&quot;Testing the Pinned Site API&quot; /&gt;
&lt;style&gt;
body {
    background: none repeat scroll 0 0 #4492CE;
    color: #EDEFF4;
}

h1 {
    float: left;
    font: 440%/1.4em 'Segoe Light',Segoe,'Segoe UI','Meiryo Regular','Meiryo',sans-serif;
    margin-left: 10px;
    position: relative;
}
&lt;/style&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;h1&gt;Pinned Site Test&lt;/h1&gt;

&lt;div&gt;&lt;/div&gt;

&lt;script&gt;

    var myPin = {

        currIndex: 0,
        dataBin: [],

        getData: function () {
            // A function that just simulates returning a result set...
            var idx = 0;

            // Determines whether the current page was launched as a pinned site.
            if (window.external.msIsSiteMode()) {

                idx = this.currIndex++;
                this.currIndex = (this.currIndex &lt; 5) ? this.currIndex : 0;

                this.dispOverlay(this.dataBin[idx]);

            }

        },

        setOverlay: function (icon, desc) {

            // Sets the overlay icons...
            window.external.msSiteModeSetIconOverlay(icon, desc);
            window.external.msSiteModeActivate();

        },

        dispOverlay: function (theData) {

            var oImg = &quot;&quot;;

            // Is there any data?
            if (theData) {

                // Clear any preexisting overlay icon
                window.external.msSiteModeClearIconOverlay();

                // Create the image string...
                oImg = &quot;images/num_&quot; + theData.num + &quot;.ico&quot;;

                // Go ahead and create the overlay image and it's label...
                this.setOverlay(oImg, theData.label);

            }

        },

        init: function (myData) {

            this.dataBin = myData;

        }

    };

    // This clears out any previously set overlay icons...
    window.external.msSiteModeClearIconOverlay();

    // Run it once to kick everything off...
    myPin.init([{ &quot;num&quot;: 1, &quot;label&quot;: &quot;Label 1&quot; },
                { &quot;num&quot;: 2, &quot;label&quot;: &quot;Label 2&quot; },
                { &quot;num&quot;: 3, &quot;label&quot;: &quot;Label 3&quot; },
                { &quot;num&quot;: 4, &quot;label&quot;: &quot;Label 4&quot; },
                { &quot;num&quot;: 5, &quot;label&quot;: &quot;Label 5&quot; }
                ]);

    // This is only here because I want to simulate pulling data on a regular interval...
    setInterval(function () { myPin.getData(); }, 5000);

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2011/10/10/using-site-pinning-and-overlay-icons-for-enhanced-user-notifications-and-engagement/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Eloquent JavaScript is one of the Best JavaScript Books I&#8217;ve Read</title>
		<link>http://blog.reybango.com/2011/03/23/eloquent-javascript-is-one-of-the-best-javascript-books-ive-read/</link>
		<comments>http://blog.reybango.com/2011/03/23/eloquent-javascript-is-one-of-the-best-javascript-books-ive-read/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 15:35:54 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1618</guid>
		<description><![CDATA[The kind folks at No Starch sent me over a copy of the newly released book, Eloquent JavaScript by Marjin Haverbeke. I had already been recommending the namesake site as a must-read resource on my list of What to Read to Get Up to Speed in JavaScript so actually having the book was a welcome [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/1593272820/ref=as_li_ss_tl?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1593272820"><img src="http://blog.reybango.com/wp-content/uploads/2011/03/ejs-227x300.png" alt="" title="ejs" width="227" height="300" class="alignright size-medium wp-image-1623" style="float:right; margin-left: 10px;" /></a></p>
<p>The kind folks at No Starch sent me over a copy of the newly released book, <a href="http://www.amazon.com/gp/product/1593272820/ref=as_li_ss_tl?ie=UTF8&#038;tag=rebasbl-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=1593272820">Eloquent JavaScript</a> by Marjin Haverbeke. I had already been recommending <a href="http://eloquentjavascript.net/">the namesake site</a> as a must-read resource on my list of <a href="http://blog.reybango.com/2010/12/15/what-to-read-to-get-up-to-speed-in-javascript/">What to Read to Get Up to Speed in JavaScript</a> so actually having the book was a welcome change. I know some people love to read stuff on the web but call me old fashioned in that I really like the feel of a book in my hands.</p>
<p>What I loved about this book is that it&#8217;s not your typical reference tomb. The basic premise is that it&#8217;s going to teach you proper constructs for writing solid JavaScript code as opposed to listing every method, attribute, data type or property ever included in the JavaScript language. It gets straight to the meat of JavaScript development, introducing you to the basic constructs of the language and then quickly diving into more complex topics such as partials and currying. This is all done in a step-by-step approach to give the reader an opportunity to not only digest the material but also see actual results in real-time. Definitely a great approach.</p>
<h2>Differences Between the Site and the Book</h2>
<p>As I mentioned the book is based on the great work that Marjin did on the namesake site. I&#8217;ve seen the site and absolutely love it but to me, I feel the book is a MUCH more organized version of his thoughts. The content is broken down into logical sections with better headers which makes conceptualizing specific areas much easier. </p>
<p>And again, I truly am partial to reading books instead of websites so for me, having the book was a real blessing. </p>
<h2>What about JavaScript Libraries?</h2>
<p>This book is really focused on the JavaScript language itself and not libraries. If you&#8217;re interested in really becoming a better JavaScript developer so you can take full advantage of your favorite library, then this book is a great choice. It&#8217;s a complementary selection.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2011/03/23/eloquent-javascript-is-one-of-the-best-javascript-books-ive-read/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>My Visual Studio 2010 HTML5 Templates are Updated for jQuery 1.5.1 and Modernizr 1.7</title>
		<link>http://blog.reybango.com/2011/03/22/my-visual-studio-2010-html5-templates-are-updated-for-jquery-1-5-1-and-modernizr-1-7/</link>
		<comments>http://blog.reybango.com/2011/03/22/my-visual-studio-2010-html5-templates-are-updated-for-jquery-1-5-1-and-modernizr-1-7/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 22:53:39 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1596</guid>
		<description><![CDATA[I wanted to do a refresh of the Visual Studio 2010 HTML5 Templates I created last September. With jQuery now at v1.5.1 and Modernizr at v1.7, it was time for an update. If you&#8217;ve already downloaded my original templates, you can simply overwrite those with the following files. If you&#8217;re new to this, then download [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I wanted to do a refresh of the <a href="http://blog.reybango.com/2010/09/21/how-to-create-html5-website-and-page-templates-for-visual-studio-2010/">Visual Studio 2010 HTML5 Templates I created last September</a>. With jQuery now at v1.5.1 and Modernizr at v1.7, it was time for an update.</p>
<p>If you&#8217;ve already downloaded my original templates, you can simply overwrite those with the following files. If you&#8217;re new to this, then download the files and drop them into the folders I mention immediately below each file:</p>
<p><a href='http://blog.reybango.com/wp-content/uploads/2011/03/HTML5-Page-Template.zip'>HTML5 Page Template with jQuery 1.5.1 &#038; Modernizr 1.7</a></p>
<p>Drop this into “Visual Studio 2010 > Templates > ItemTemplates” folder</p>
<p><a href='http://blog.reybango.com/wp-content/uploads/2011/03/HTML5-Web-Site.zip'>HTML5 Web Site Template with jQuery 1.5.1 &#038; Modernizr 1.7</a></p>
<p>Drop this into “Visual Studio 2010 > Templates > ProjectTemplates” folder</p>
<h2>Using the Templates</h2>
<p>Once in place, all you have to do is select “File=>New Web Site” to use the new template:</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2010/09/template-choice.png"><img src="http://blog.reybango.com/wp-content/uploads/2010/09/template-choice-300x207.png" alt="" title="template-choice" class="alignleft size-medium wp-image-1371" width="300" height="207"></a></p>
<p>To create a new HTML5 web page template, you&#8217;d select “File=>New File” to choose the HTML5 Page Template</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2011/03/html5-page-template.png"><img src="http://blog.reybango.com/wp-content/uploads/2011/03/html5-page-template-300x207.png" alt="" title="html5-page-template" width="300" height="207" class="alignleft size-medium wp-image-1609" /></a></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2011/03/22/my-visual-studio-2010-html5-templates-are-updated-for-jquery-1-5-1-and-modernizr-1-7/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
		<item>
		<title>What to Read to Get Up to Speed in JavaScript</title>
		<link>http://blog.reybango.com/2010/12/15/what-to-read-to-get-up-to-speed-in-javascript/</link>
		<comments>http://blog.reybango.com/2010/12/15/what-to-read-to-get-up-to-speed-in-javascript/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 14:31:15 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1523</guid>
		<description><![CDATA[There&#8217;s a discussion going on on the JSMentors JavaScript mailing list about books to read to get you to the next level. There&#8217;s been a lot of great feedback and suggestions thrown out and I wanted to offer up what I felt were good books/resources to carry you through the learning process. While I list [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a <a href="http://groups.google.com/group/jsmentors/browse_thread/thread/336a60331692fae0?tvc=2">discussion going on on the JSMentors JavaScript mailing list about books to read to get you to the next level</a>. There&#8217;s been a lot of great feedback and suggestions thrown out and I wanted to offer up what I felt were good <strong>books/resources</strong> to carry you through the learning process. While I list a number of books in the <a href="http://blog.reybango.com/the-big-list-of-javascript-css-and-html-development-tools-libraries-projects-and-books/#books-js">Big List page that I created</a>, narrowing it down into specific levels makes a lot of sense. </p>
<p>Note that some resources will overlap between levels. That should be expected as some books cover a wide breadth of language features. Also, I am NOT covering blogs in this post, only books (print and online). <strong>If you think something&#8217;s missing, please add it to the comments below.</strong></p>
<p><strong><em>Also, I&#8217;m not saying that you need to read every book mentioned below.</em></strong> These are books that I&#8217;ve read over the years and found incredibly useful so I&#8217;m categorizing them to make it easier for you to get going. I&#8217;ve done the legwork so need for you to do the same. Choose the books that you feel suit you.</p>
<h2>Introductory</h2>
<p>These are books that will give you the fundamentals of the JavaScript language and get you started:</p>
<ul>
<li><a href="http://www.amazon.com/gp/product/0596517742?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596517742">JavaScript: The Good Parts</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=0596517742" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/047022780X?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=047022780X">Professional JavaScript for Web Developers (Wrox Programmer to Programmer)</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=047022780X" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/0321423305?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0321423305">ppk on JavaScript, 1/e</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=0321423305" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/1590596803?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1590596803">Beginning JavaScript with DOM Scripting and Ajax: From Novice to Professional (Beginning: from Novice to Professional)</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=1590596803" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://eloquentjavascript.net/">Eloquent JavaScript</a> (Online Resource)</li>
</ul>
<h2>Intermediate</h2>
<p>Once you&#8217;ve gotten an understanding of the basics, it&#8217;s time to get a resource that will take you deeper and in many cases be your reference for years to come. These books fit that description.</p>
<ul>
<li><a href="http://www.amazon.com/gp/product/047022780X?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=047022780X">Professional JavaScript for Web Developers (Wrox Programmer to Programmer)</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=047022780X" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/0596101996?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596101996">JavaScript: The Definitive Guide</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=0596101996" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://eloquentjavascript.net/">Eloquent JavaScript</a> (Online Resource)</li>
<li><a href="http://www.amazon.com/gp/product/1590595335?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1590595335">DOM Scripting: Web Design with JavaScript and the Document Object Model</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=1590595335" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"> &#8211; Not JavaScript-specific but a good resource for learning to interact with the DOM</li>
</ul>
<h2>Advanced</h2>
<p>You have a firm grasp of the JavaScript language and now you want to step up your game. These books will help you get the knowledge you need to organize your applications and build maintainable code.</p>
<ul>
<li><a href="http://www.amazon.com/gp/product/059680279X?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=059680279X">High Performance JavaScript (Build Faster Web Application Interfaces)</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=059680279X" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1">
</li>
<li><a href="http://www.amazon.com/gp/product/1847194141?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1847194141">Object-Oriented JavaScript: Create scalable, reusable high-quality JavaScript applications and libraries</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=1847194141" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/0596806752?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596806752">JavaScript Patterns</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=0596806752" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/1934356670?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1934356670">Pragmatic Guide to JavaScript</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=1934356670" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/1590597273?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1590597273">Pro JavaScript Techniques</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=1590597273" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/193398869X?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=193398869X">Secrets of the JavaScript Ninja</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=193398869X" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
</ul>
<h2>God Mode Reading</h2>
<p>As <a href="http://qfox.nl/">Peter van der Zee</a> likes to call it <em>&#8220;godmode; the actual specification&#8221;</em>. Want some deep reading and know every nook and cranny of the language. Here ya go:</p>
<ul>
<li><a href="http://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%203rd%20edition,%20December%201999.pdf">Standard ECMA-262 ECMAScript Language Specification 3rd edition (December 1999) &#8211; <strong>PDF File</strong></a> &#8211; This is what&#8217;s widely supported in all major browsers
</li>
<li><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">Standard ECMA-262 ECMAScript Language Specification 5th edition (December 2009)</a> &#8211; This is what all major browser vendors are working to implement</li>
</ul>
<h2>Blogs</h2>
<ul>
<li><a href="http://scriptJunkie.com">ScriptJunkie.com</a> &#8211; I&#8217;m a little biased on this one because I manage this site but I work hard to get really good content about JavaScript as well as HTML &#038; CSS</li>
<li><a href="http://jsmentors.com/">JSmentors.com</a> &#8211; the JavaScript mailing list I started with <a href="http://twitter.com/abozhilov">Asen Bozhilov</a> which provides a safe, professional place to discuss JavaScript and learn from the best</li>
<li><a href="http://dailyjs.com/">DailyJS</a></li>
<li><a href="http://badassjs.com/">BadassJS</a></li>
<li><a href="http://javascriptweekly.com/">JavaScript Weekly Newsletter</a></li>
<li><a href="http://www.jsmag.com/">JSMag</a> &#8211; Monthly Magazine</li>
<li><a href="http://developer.yahoo.com/yui/theater/">YUI Theatre</a> &#8211; Tons of videos on JavaScript-related topics</li>
<li><a href="http://ejohn.org/category/blog/">John Resig</a></li>
<li><a href="http://qfox.nl/weblog">Peter van der Zee</a></li>
<li><a href="http://michaux.ca/">Peter Michaux</a></li>
<li><a href="http://jsmentors.com/Garrett-Smith.html">Garrett Smith</a></li>
<li><a href="http://jsmentors.com/Juriy-Zaytsev.html">Juriy Zaytsev a.k.a. kangax</a></li>
<li><a href="http://jsmentors.com/Dmitry-A-Soshnikov.html">Dmitry A. Soshnikov</a></li>
<li><a href="http://jsmentors.com/Steven-Levithan.html">Steven Levithan</a></li>
<li><a href="http://jsmentors.com/John-David-Dalton.html">John-David Dalton</a></li>
<li><a href="http://jsmentors.com/Stoyan-Stefanov.html">Stoyan Stefanov</a></li>
<li><a href="http://jsmentors.com/Benjamin-Rosseaux.html">Benjamin Rosseaux a.k.a. BeRo</a></li>
<li><a href="http://jsmentors.com/Diego-Perini.html">Diego Perini</a></li>
<li><a href="http://javascriptweblog.wordpress.com/">Angus Croll</a></li>
<li><a href="http://jsmentors.com/Peter-van-der-Zee.html">Peter van der Zee</a></li>
<li><a href="http://jsmentors.com/Christian-C-Salvado.html">Christian C. Salvadó</a></li>
<li><a href=http://jsmentors.com/"Christophe-Porteneuve.html">Christophe Porteneuve</a></li>
<li><a href="http://jsmentors.com/Nicholas-C-Zakas.html">Nicholas C. Zakas</a></li>
<li><a href="http://jsmentors.com/David-Flanagan.html">David Flanagan</a></li>
<li><a href="http://feeds.feedburner.com/reybango/zSyW">Rey Bango</a> &#8211; That&#8217;s me! Here&#8217;s my feed URL. Subscribe!</li>
</ul>
<h2>What if *I* had to Choose Just 3 Books</h2>
<p>If I had to choose just three books to have in my stash, I&#8217;d go with the following:</p>
<ul>
<li><a href="http://www.amazon.com/gp/product/047022780X?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=047022780X">Professional JavaScript for Web Developers (Wrox Programmer to Programmer)</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=047022780X" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/1847194141?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1847194141">Object-Oriented JavaScript: Create scalable, reusable high-quality JavaScript applications and libraries</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=1847194141" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
<li><a href="http://www.amazon.com/gp/product/0596806752?ie=UTF8&amp;tag=rebasbl-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596806752">JavaScript Patterns</a><img class=" ztjyztsxjfidzcmozwna" src="http://www.assoc-amazon.com/e/ir?t=rebasbl-20&amp;l=as2&amp;o=1&amp;a=0596806752" alt="" style="border: medium none ! important; margin: 0px ! important;" border="0" height="1" width="1"></li>
</ul>
<p>Some may disagree with me on this but I&#8217;ve personally found each one of these books incredibly valuable. Professional JavaScript for Web Developers is a complete reference and covers EVERYTHING. All developers need a book like this. The book on Object-Oriented JavaScript is great to give you an understanding of leveraging one of the best features in JavaScript. Once you get past the basics, you&#8217;re going to want to identify key coding practices that make your code better and more maintainable. JavaScript Patterns helps you do that.</p>
<p>What would you guys choose?</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2010/12/15/what-to-read-to-get-up-to-speed-in-javascript/feed/</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>Why We Built the JSMentors.com JavaScript Mailing List</title>
		<link>http://blog.reybango.com/2010/12/02/why-we-built-the-jsmentors-com-javascript-mailing-list/</link>
		<comments>http://blog.reybango.com/2010/12/02/why-we-built-the-jsmentors-com-javascript-mailing-list/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 15:12:19 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1487</guid>
		<description><![CDATA[I posted earlier this week about the launch of the JSMentors.com mailing list. So far the response has been amazing. The list has grown from 344 on Nov 29 to 900+ today. Just phenomenal growth and a testament to the need of the list. But where did this idea come from? comp.lang.javascript Was Not for [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I posted earlier this week <a href="http://blog.reybango.com/2010/11/29/jsmentors-com-the-mailing-list-to-learn-javascript-in-a-professional-and-courteous-environment/">about the launch of the JSMentors.com mailing list</a>. So far the response has been amazing. The list has grown from 344 on Nov 29 to 900+ today. Just phenomenal growth and a testament to the need of the list. But where did this idea come from?</p>
<h2>comp.lang.javascript Was Not for Me</h2>
<p>I&#8217;ve been involved in the JavaScript community for some time, especially with the jQuery JavaScript library project. I&#8217;ve been fortunate to make a lot of friends who have helped me overcome many of the pitfalls and hurdles normally associated with becoming a JavaScript developer. As I began feeling more confident, I did what I feel most people do when they want to advance their skills to the next level and ventured over to <a href="http://groups.google.com/group/comp.lang.javascript/topics">comp.lang.javascript</a> (CLJ). CLJ has a long history due to its roots in the newsgroup mediums which predated forums as the main method of communicating about many topics. I had heard that the developers there were top notch and you could find great content. To me, this was the obvious place to go. So I went. <strong>And I regretted it.</strong></p>
<p>Everything people said was true. There are many incredibly smart and savvy JavaScript developers there; I would say some of the best in the world. The problem I encountered was a consistent lack of manners, courtesy and respect that completely overshadowed any of the conversations that were going on. <a href="http://james.padolsey.com/javascript/javascripts-dark-alley/">I&#8217;m not alone in this feeling</a>. And this seemed to be happening due to a small but vocal minority that tended to hijack any thread and turn them into their own chest-thumping diatribe. I&#8217;ve dealt with tough crowds before but even I was shocked by what was happening here. Couple that with the insane amount of spam being posted there, I knew that *I* wouldn&#8217;t be successful in this environment (CLJ) in spite of some of the great information being posted. Notice how I highlighted &#8220;*I*&#8221;. That&#8217;s because CLJ may be perfectly suited for others. I know <a href="http://perfectionkills.com/">several</a> <a href="http://dhtmlkitchen.com/">developers</a> <a href="http://www.netben.nl/">who</a> participate and find it useful. It just wasn&#8217;t for me.</p>
<h2>A Community Resource</h2>
<p>So I began chatting with <a href="http://asenbozhilov.com">Asen Bozhilov</a> about this and explained how I would love to see a list where anyone who wanted to become a better JavaScript developer could go to and participate in a courteous, respectful and professional environment. It was also important to have as many of the non-confrontational experts on CLJ serve as mentors and share their knowledge with people who genuinely wanted to learn but didn&#8217;t want to be shot down or berated due to their skill level. So Asen &#038; I set about creating <a href="http://jsmentors.com/">JSMentors.com</a>. Asen is one of this super experts and he has very close ties with many of the experts on CLJ. After chatting with them a bit, many found this to be a great idea, especially since it offered them:</p>
<ul>
<li>A chance to teach best practices to an ever-growing community of developers</li>
<li>A medium to publish content that they felt was important</li>
<li>An opportunity for the JavaScript world to meet these top developers and begin learning from some of the best</li>
</ul>
<p>The important part was that each of these mentors understood that this list was going to be very different and that our goal was to nurture a community. And we made the rules of the list perfectly clear to ensure no confusion:</p>
<ul>
<li>No insulting other subscribers</li>
<li>No posting racism</li>
<li>No spam publications</li>
</ul>
<p>This had to be different from CLJ to work. It had to focus not only on the language but also the community.</p>
<h2>JSMentors.com is Born</h2>
<p>The list was launched with little fanfare. We wanted it to grow organically to see how people would react and that was a great tact. Since launching, we&#8217;ve steadily grown the mailing list as well as the <a href="http://jsmentors.com/">list of mentors</a>. The great thing is that we&#8217;re getting top-level developers involved who would never had considered participating in CLJ due to the tough nature of communication there. This was exactly what we wanted. A place where developers of ALL skill levels can go and exchange ideas in a professional setting. It&#8217;s not to say that occasionally there won&#8217;t be disagreements. That&#8217;s normal. But Asen &#038; I actively monitor the list and we&#8217;re adamant about the rules we&#8217;ve set and maintaining a good list. Ultimately, we want everyone to become better developers and yes, I have a little selfish motivation myself as the opportunity to learn from so many top developers is one my drivers for this list. And I think that&#8217;s a good thing. <img src='http://blog.reybango.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2010/12/02/why-we-built-the-jsmentors-com-javascript-mailing-list/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>JSMentors.com &#8211; The Mailing List to Learn JavaScript in a Professional and Courteous Environment</title>
		<link>http://blog.reybango.com/2010/11/29/jsmentors-com-the-mailing-list-to-learn-javascript-in-a-professional-and-courteous-environment/</link>
		<comments>http://blog.reybango.com/2010/11/29/jsmentors-com-the-mailing-list-to-learn-javascript-in-a-professional-and-courteous-environment/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 14:36:47 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1482</guid>
		<description><![CDATA[There are a number of resources on the Internet for reading up on JavaScript but very few viable options for actually exchanging ideas with extremely knowledgeable JavaScript developers, especially when it comes to just wanting to know about JavaScript itself and not a specific JS library. This was a pain point I personally felt when [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>There are a number of resources on the Internet for reading up on JavaScript but very few viable options for actually exchanging ideas with extremely knowledgeable JavaScript developers, especially when it comes to just wanting to know about JavaScript itself and not a specific JS library. This was a pain point I personally felt when I wanted to learn more about the language and be able to have &#8220;mentors&#8221; that could help me better understand JS and ECMAScript.</p>
<p>After chatting a bit with JavaScript expert <a href="http://twitter.com/#!/abozhilov">Asen Bozhilov</a> about this, we decided to fill that hole by launching a new mailing list called <a href="http://jsmentors.com/">JSMentors</a> that allows developers to get to know the language and find the expert guidance in a friendly and professional environment. The list offers developers a place to:</p>
<ul>
<li>Discuss ECMA-262 standard</li>
<li>Discuss different implementations of ECMA-262</li>
<li>Discuss different host environments of JavaScript</li>
<li>Discuss implementation of algorithms in JavaScript</li>
<li>Discuss your library design</li>
<li>Review your code</li>
<li>Review your book on JavaScript topic</li>
<li>Review your article on JavaScript topic</li>
</ul>
<p>We also wanted to provide a list that was <strong>professional, courteous, and friendly to developers of all skill levels</strong>. Too many forums, newsgroups and lists look down on beginners or questions deemed too introductory and we wanted to ensure that JSMentors didn&#8217;t fall into that same hole. So we created a set of simple rules. Via the JSMentors mailing list you must not:</p>
<ul>
<li>Insult other subscribers</li>
<li>Post racism</li>
<li>Spam publications</li>
</ul>
<p>So far it&#8217;s been working great and developers are getting the mentoring that they desperately want and need. And the great thing is that the mentors are a who&#8217;s-who of the JavaScript world. Check out this list:</p>
<ul>
<li>Garrett Smith</li>
<li>Juriy Zaytsev a.k.a. kangax</li>
<li>Dmitry A. Soshnikov</li>
<li>Steven Levithan</li>
<li>John-David Dalton</li>
<li>Stoyan Stefanov</li>
<li>Benjamin Rosseaux a.k.a. BeRo</li>
<li>Diego Perini</li>
<li>Angus Croll</li>
<li>Peter van der Zee</li>
<li>Christian C. Salvadó</li>
<li>Peter Michaux</li>
</ul>
<p>One important thing to note is that the main focus of the list is <strong>the JavaScript language</strong> and while you can post about JavaScript libraries, you&#8217;re more likely to get a better answer in a library&#8217;s specific support forum or list than on JSMentors.com.</p>
<p>Asen and I would like to invite developers to join <a href="http://jsmentors.com/">JSMentors.com</a> and create a productive list to help everyone become better JavaScript developers and help push the web forward.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2010/11/29/jsmentors-com-the-mailing-list-to-learn-javascript-in-a-professional-and-courteous-environment/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Presenting at the jQuery Summit Online Conference on November 17th</title>
		<link>http://blog.reybango.com/2010/11/12/presenting-at-the-jquery-summit-online-conference-on-november-17th/</link>
		<comments>http://blog.reybango.com/2010/11/12/presenting-at-the-jquery-summit-online-conference-on-november-17th/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 16:20:08 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1475</guid>
		<description><![CDATA[Next week, Environments for Humans will be hosting their 2nd jQuery Summit Online Conference and what a great event it will be. The speakers (myself included) are just an who&#8217;s-who of the jQuery world so you can be sure to get awesome presentations during the event. Lined up are experts like: John Resig Jonathan Snook [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Next week, <a href="http://www.environmentsforhumans.com/">Environments for Humans</a> will be hosting their 2nd <a href="http://www.environmentsforhumans.com/2010/jquery-summit/">jQuery Summit Online Conference</a> and what a great event it will be. The speakers (myself included) are just an who&#8217;s-who of the jQuery world so you can be sure to get awesome presentations during the event. Lined up are experts like:</p>
<ul>
<li>John Resig</li>
<li>Jonathan Snook</li>
<li>Richard Worth</li>
<li>Emily Lewis</li>
<li>&#8230;and a lot more.</li>
</ul>
<p>The event is divided into two tracks targeting designers on the 16th and developers on the 17th. I&#8217;ll be presenting on the 17th and will be discussing how to use the new jQuery Templates plugin to make code layout much easier.</p>
<p>You can register for the event by going to the <a href="http://www.environmentsforhumans.com/2010/jquery-summit/">jQuery Summit website</a> and when you do, be sure to take advantage of the following code for a 20% discount on your registration: <em><strong>JQUERY2010</strong></em></p>
<p>The great thing about this is by registering, you&#8217;re also helping out the jQuery project as <a href="http://www.environmentsforhumans.com/">Environments for Humans</a> is donating part of the proceeds of the conference to the jQuery Foundation.</p>
<p>I&#8217;m looking forward to this event and I hope to see you there as well!</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2010/11/12/presenting-at-the-jquery-summit-online-conference-on-november-17th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Polyfills &#8220;fill in the gaps&#8221; to make HTML5 and CSS3 Usable Today</title>
		<link>http://blog.reybango.com/2010/10/11/how-polyfills-fill-in-the-gaps-to-make-html5-and-css3-usable-today/</link>
		<comments>http://blog.reybango.com/2010/10/11/how-polyfills-fill-in-the-gaps-to-make-html5-and-css3-usable-today/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 15:52:21 +0000</pubDate>
		<dc:creator>Rey Bango</dc:creator>
				<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.reybango.com/?p=1416</guid>
		<description><![CDATA[There&#8217;s been a lot of commotion over the last week since the W3C announced that HTML5 is not ready yet for deployment to websites. Some really smart people have weighed in on this topic and I agree with their thoughts. Last Thursday, I did a presentation on the new features of HTML5 and part of [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s been a lot of commotion over the last week since the W3C announced that <a href="http://www.infoworld.com/d/developer-world/w3c-hold-html5-in-websites-041?page=0,0">HTML5 is not ready yet for deployment to websites</a>. Some really <a href="http://remy.tumblr.com/post/1261575750/hold-off-on-deploying-html5-in-websites">smart</a> <a href="http://almaer.com/blog/dont-deploy-html5-thanks-again-w3c">people</a> have weighed in on this topic and I agree with their thoughts. Last Thursday, I did a presentation on the new features of HTML5 and part of that was demonstrating how polyfills work to allow you to leverage these new features while still providing a good cross-browser experience.</p>
<h2>What&#8217;s a Polyfill?</h2>
<p>I really love Paul Irish&#8217;s definition since it sums it up perfectly:</p>
<blockquote><p>polyfill: A shim that mimics a future API, providing fallback functionality to older browsers.</p></blockquote>
<p>The basic premise is that most older browsers may not have all of the features of the HTML5 and CSS3 specifications and they need a helping hand to make them provide a good user experience. A great example of this are the new HTML5 semantic tags like &lt;article&gt;, &lt;section&gt;, &lt;header&gt; &#038; &lt;nav&gt; which render fine in all major modern browsers like IE9 beta, Firefox, Chrome, Safari &#038; Opera but lack support in popular browsers like IE6 through IE8. </p>
<p>So for my demo, I decided to create a simple page that showed a blog-like layout using these new tags while ensuring that they can still render correctly in IE8. Here&#8217;s the layout code I used. </p>
<pre class="brush: xml; title: ; notranslate">
&lt;!doctype html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot; /&gt;
    &lt;title&gt;Rey's Awesome HTML5 Blog&lt;/title&gt;
    &lt;meta name=&quot;description&quot; content=&quot;&quot; /&gt;
    &lt;meta name=&quot;keywords&quot; content=&quot;&quot; /&gt;
    &lt;meta name=&quot;author&quot; content=&quot;&quot; /&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width; initial-scale=1.0&quot; /&gt;

    &lt;!-- !CSS --&gt;
    &lt;link href=&quot;css/html5reset.css&quot; rel=&quot;stylesheet&quot; /&gt;
    &lt;link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; /&gt;

&lt;/head&gt;

&lt;body&gt;

	&lt;header&gt;
        &lt;h1&gt;Rey's Awesome HTML5 Blog&lt;/h1&gt;
	&lt;/header&gt;

    &lt;nav&gt;
    	&lt;ul&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
    &lt;/nav&gt;

	&lt;section&gt;

        &lt;header&gt;
        &lt;h1&gt;Rey's Blog Posts&lt;/h1&gt;
	    &lt;/header&gt;

        &lt;article&gt;
            &lt;header&gt;&lt;h1&gt;The In's &amp; Out's of HTML5&lt;/h1&gt;&lt;/header&gt;
		    &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing  elit. Fusce vitae orci. &lt;/p&gt;

            &lt;footer&gt;
                October 7, 2010 - comments( 0 )
            &lt;/footer&gt;
        &lt;/article&gt;

        &lt;article&gt;
            &lt;header&gt;&lt;h1&gt;HTML5 Ate My Lunch&lt;/h1&gt;&lt;/header&gt;
		    &lt;p&gt;Fusce vitae orci. Lorem ipsum dolor sit amet, consectetuer adipiscing  elit. &lt;/p&gt;
            &lt;footer&gt;
                October 5, 2010 - comments( 3 )
            &lt;/footer&gt;
	    &lt;/article&gt;		

	&lt;/section&gt;

	&lt;footer&gt;
		&lt;p&gt;Copyright Rey Bango, 2010&lt;/p&gt;
	&lt;/footer&gt;

&lt;/body&gt;
 &lt;/html&gt;
</pre>
<p>I used a <a href="http://html5doctor.com/html-5-reset-stylesheet/">HTML5 reset style sheet</a> because unfortunately, most browser don&#8217;t have an internal style sheet that sets the expected behavior for specific elements. For example, you would expect an &lt;section&gt; element to be block level but due to a lack of the internal browser style sheet, it renders inline. </p>
<p>Then, I added the styles I needed to get my page to look the way I wanted:</p>
<pre class="brush: css; title: ; notranslate">
/* Global */
body { font-size: 16px; font-family: arial,helvetica,clean,sans-serif;  }
a { color : #33CC33; }
a:hover { text-decoration: none; }

/* Header */
header h1 { font-size: 48px; }

nav { overflow: auto; margin-bottom: 25px; }
nav li {float:left; padding-right: 5px; }

/* Main Content Area */
section { width: 500px; font-size: 12px; }
section h1 { font-size: 16px; }

article { background: #CCCC99; margin-bottom: 10px; padding: 5px; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
article footer { text-align: right; margin-right:5px; }
article h1 { font-size: 12px; }
</pre>
<p>and when I tested it in Firefox 3.6.10, it looked exactly like I expected:</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2010/10/fx-blog.png"><img src="http://blog.reybango.com/wp-content/uploads/2010/10/fx-blog-300x180.png" alt="" title="fx-blog" width="300" height="180" class="alignleft size-medium wp-image-1429" /></a></p>
<p>but look what happened when I tried to bring up the page in IE8:</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2010/10/ie8-blog-nopf.png"><img src="http://blog.reybango.com/wp-content/uploads/2010/10/ie8-blog-nopf-300x239.png" alt="" title="ie8-blog-nopf" width="300" height="239" class="alignleft size-medium wp-image-1434" /></a></p>
<p>None of the stylings were available because IE8 doesn&#8217;t recognize the new HTML5 elements. Further, in order to get IE6-8 to recognize these elements, you explicitly have to create the DOM nodes for them using JavaScript. The exact reason is unclear but it may be some type of parser bug. The following code needs to be in the &lt;head&gt; section of your page in order for the elements to be created and recognized by IE6-8:</p>
<pre class="brush: jscript; title: ; notranslate">
document.createElement(&quot;header&quot;);
document.createElement(&quot;nav&quot;);
document.createElement(&quot;section&quot;);
document.createElement(&quot;article&quot;);
document.createElement(&quot;footer&quot;);
</pre>
<p>It&#8217;s a little bothersome to do that but it&#8217;s not a massive bit of code at least.</p>
<h2>Enter Modernizr</h2>
<p>The code I just listed to create your HTML5 elements is certainly useful but work has already been done to handle that for us via the awesome <a href="http://www.modernizr.com/">Modernizr JavaScript library</a>. Not only does it act as a polyfill, creating these new elements for us automatically, but it offers a ton of detection capabilities for features of both HTML5 &#038; CSS3. This allows you to determine how you will offer fallback support when a feature isn&#8217;t available.</p>
<p>Including Modernizr.js is incredibly easy since it&#8217;s only a one line script tag like this:</p>
<p>&lt;script src=&quot;js/modernizr-1.5.min.js&quot;&gt;&lt;/script&gt;</p>
<p>As I mentioned, Modernizr is smart enough to determine when new semantic elements need to be created and will handle the dynamic creation of elements such as &lt;article&gt;, &lt;section&gt;, &lt;header&gt; &#038; &lt;nav&gt; instead of you having to write JavaScript code to do it. So once I&#8217;ve added Modernizr to my page, I get the following results in IE8:</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2010/10/ie8-blog-mod.png"><img src="http://blog.reybango.com/wp-content/uploads/2010/10/ie8-blog-mod-300x176.png" alt="" title="ie8-blog-mod" width="300" height="176" class="alignleft size-medium wp-image-1441" /></a></p>
<p>Now you&#8217;re probably looking at this screenshot and say, &#8220;Hey, you have no rounded corners!&#8221;. You&#8217;re right because I used the CSS3 <em>border-radius</em> property to create rounder corners for all of my &lt;article&gt; elements and IE8 doesn&#8217;t support that property. The important thing, though, is that IE8 now recognizes these new elements and allowed me to style them.</p>
<h2>But What About those Rounder Corners?</h2>
<p>Geez, you guys are so demanding! Okay, so the cool thing is that Modernizr offers detection of key features of HTML5 *and* CSS3 and with that, we can determine if something like <em>border-radius</em> is available and if not, using a new term coined by Alex Sexton, we&#8217;ll use &#8220;<strong>regressive enhancement</strong>&#8221; to provide similar capabilities for older browsers. In this case, we&#8217;re going to see if border-radius is available and if not, lazyload in <a href="http://jquery.malsup.com/corner/">Mike Aslup&#8217;s jQuery Corners plugin</a> to fill in the gap:</p>
<pre class="brush: jscript; title: ; notranslate">
    &lt;!-- Load jQuery --&gt;
    &lt;script src=&quot;http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;

    &lt;script type=&quot;text/javascript&quot;&gt;
        // See if border-radius is available
        if (!Modernizr.borderradius) {

            // If not, then load in the jQuery Corners plugin and apply rounded corners to the article elements
            $.getScript(&quot;js/jquery.corner.js&quot;, function () {
                $(&quot;article&quot;).corner();
            });

        }
    &lt;/script&gt;
</pre>
<p>Now, when the code detects that <em>border-radius</em> is not available, it will just use the Corners jQuery plugin instead and render the following in any browser that doesn&#8217;t support the property:</p>
<p><a href="http://blog.reybango.com/wp-content/uploads/2010/10/ie8-blog-mod-corners.png"><img src="http://blog.reybango.com/wp-content/uploads/2010/10/ie8-blog-mod-corners-300x176.png" alt="" title="ie8-blog-mod-corners" width="300" height="176" class="alignleft size-medium wp-image-1449" /></a></p>
<h2>Download the Code</h2>
<p>I hope this post has shown you how polyfills can allow you to use HTML5 &#038; CSS3 today. While I respect the W3C&#8217;s desire to ensure that the HTML5 specification is up-to-snuff, I think it&#8217;s important to realize that developers are resourceful and professional enough to create best practices that allow us to build apps with these new features right now.</p>
<p>I would highly recommend reviewing this <a href="http://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills">VERY BIG LIST of polyfills and shims</a> which can provide much of the missing capabilities in older browsers. </p>
<p>If you&#8217;d like to play with the code directly, I&#8217;ve packaged it up in a .zip file and you can download it here:</p>
<p><a href='http://blog.reybango.com/wp-content/uploads/2010/10/polyfills.zip'>Code for HTML5 Semantic Tags using Polyfill to Degrade Gracefully (.zip)</a></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.reybango.com/2010/10/11/how-polyfills-fill-in-the-gaps-to-make-html5-and-css3-usable-today/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
