<?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>habdas.org &#187; Web Development</title>
	<atom:link href="http://www.habdas.org/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.habdas.org</link>
	<description>The technical blog of Josh Habdas</description>
	<lastBuildDate>Thu, 02 Sep 2010 02:06:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MSIE 4095 Selector Limit</title>
		<link>http://www.habdas.org/2010/05/30/msie-4095-selector-limit/</link>
		<comments>http://www.habdas.org/2010/05/30/msie-4095-selector-limit/#comments</comments>
		<pubDate>Sun, 30 May 2010 17:50:31 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browser compatibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[debugging tools]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=1250</guid>
		<description><![CDATA[Web applications concatenate CSS files to improve performance, which can result in large numbers of style rules in a single file. Enter the 4095 selector limitation for IE browsers. An IE bug whereby the browser will only apply style for the first 4095 selectors declared per file. Impacted browsers include IE6, IE7, IE8 and IE9. [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="font-weight: normal; font-size: 13px;">Web applications concatenate CSS files to improve performance, which can result in large numbers of style rules in a single file. </span><span style="font-weight: normal; font-size: 13px;">Enter the <a href="http://marc.baffl.co.uk/browser_bugs/css-selector-limit/">4095 selector limitation for IE browsers</a>. An IE bug whereby the browser will only apply style for the first 4095 selectors declared per file. Impacted browsers include IE6, IE7, IE8 and IE9.</span></h3>
<p><span style="font-weight: normal; font-size: 13px;"><span id="more-1250"></span></span></p>
<h3>Identification</h3>
<h3><span style="font-weight: normal; font-size: 13px;">Look for IE-only display issues (outside the norm) when CSS files contain many style rules. Rules near the bottom of the stylesheet will not be applied. </span><span style="font-weight: normal; font-size: 13px;">The issue can be confirmed with the IE dev toolbar. To do so use dev toolbar to save off the CSS file downloaded from the web server, and then scroll to the bottom of the CSS tab in the toolbar (assumes IE8 dev tools). Compare the last style rule displayed in the tab with the last rule in the actual file itself. If they do not match, and the CSS is valid, the limit has been reached.</span></h3>
<h3>Solution</h3>
<p>Reduce the number of CSS selectors per file to a number less than 4096. Several approaches for doing so include:</p>
<ul>
<li>Refactoring existing CSS</li>
<li>Splitting the CSS payload into multiple files</li>
<li>Reevaluating current browser support strategy (wink, wink)</li>
</ul>
<p>If the stylesheet under scrutiny contains IE-only hacks interspersed with standards compliant CSS, consider moving the hacks into a separate file and using <a href="http://www.quirksmode.org/css/condcom.html">Conditional Comments</a> to pull them in. Otherwise, the best option may be to split the CSS payload into multiple files–resulting in an extra HTTP request for all browsers, not just IE. Reevaluating browser support is another option, but probably not feasible for large-scale applications.</p>
<p>Regardless of which approach is taken, something will need to be done for IE once the per-file limit is reached. Though 4095 selectors ought to be enough for anybody&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2010/05/30/msie-4095-selector-limit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Analyzing User Agent Strings</title>
		<link>http://www.habdas.org/2009/07/22/analyzing-user-agent-strings/</link>
		<comments>http://www.habdas.org/2009/07/22/analyzing-user-agent-strings/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 02:28:23 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[user agent]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=710</guid>
		<description><![CDATA[The user agent string, a piece of data transmitted in the HTTP header during a web request, contains information valuable in determining browser type and often basic system information. Example user agent string sent from a web browser during an HTTP request: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5 [...]]]></description>
			<content:encoded><![CDATA[<p>The user agent string, a piece of data transmitted in the HTTP header during a web request, contains information valuable in determining browser type and often basic system information.</p>
<p><strong>Example user agent string sent from a web browser during an HTTP request:</strong><br />
<code>Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5</code></p>
<p>The above example, for instance, provides information such as browser and browser version, user locale (language), OS, system architecture and the layout engine used. When authoring documents for the Web, information from the user agent string can be valuable in determining how best to mark-up documents.</p>
<p>Getting the information is easy.</p>
<p><span id="more-710"></span></p>
<h3>Collecting user agent strings</h3>
<p>Two methods for accessing the user agent string include:</p>
<ol>
<li>From the HTTP request header&#8217;s User-Agent field; and</li>
<li>Using DOM and JavaScript.</li>
</ol>
<h4>Reading from the User-Agent field</h4>
<p>A benefit of using the HTTP header to gather data is simplicity of design.</p>
<p>HTTP request header showing the User-Agent field (in bold):</p>
<p><code>GET / HTTP/1.1<br />
Host: livehttpheaders.mozdev.org<br />
<strong>User-Agent:</strong> Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5<br />
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<br />
Accept-Language: en-us,en;q=0.5<br />
Accept-Encoding: gzip,deflate<br />
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br />
Keep-Alive: 300<br />
Connection: keep-alive</code></p>
<p>Using the HTTP header the user agent is transmitted directly to the HTTP server on page request, making it possible for servers to output the user agent string to a log file for later analysis. The user agent string alone provides enough information  to implement on websites valuable browser support strategies such as <a href="http://developer.yahoo.com/yui/articles/gbs/">graded browser support</a>.</p>
<h4>User agent retrieval using DOM and JavaScript</h4>
<p>Using DOM and JavaScript, on the other hand, add additional development complexity, but provide more detailed and valuable analytic data, in addition to the user agent string alone. Tools like <a href="http://en.wikipedia.org/wiki/Urchin_(software)">Urchin</a> (now Google Analytics) utilize JavaScript and the DOM to gather analytic data about visitors.</p>
<p>Bookmark the following link to create a bookmarklet that will retrieve the user agent from a browser: <code><a onclick="alert(navigator.userAgent); return false; pageTracker._trackPageview('/click/link/analyzing-user-agent-strings'); " href="#">javascript:alert(navigator.userAgent)</a></code>.</p>
<p>Regardless of the collection approach used, methods for extracting data from the string remain similar.</p>
<h3>Data extraction methods</h3>
<p>Once the user agent string(s) are collected, data extraction may take place. Two methods for reading and extracting information from the user agent string include brute force and pattern recognition:</p>
<ul>
<li>Under the <strong>brute force</strong> approach the user agent string is compared programmatically to a database of known strings. Though it offers a relatively simple implementation, the brute force approach can be difficult to maintain and becomes increasingly inefficient as comparison data sets grow larger.</li>
<li>Thanks to <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">RFC 2616</a> and preceding RFCs, and de facto standards for formatting user agent strings, another method known as <strong>pattern recognition</strong> is possible. Using pattern recognition the user agent string is broken into its component pieces and heuristics applied to gather information. Though more complex to implement than the brute force approach, pattern recognition does not suffer from the same problems in efficiency and maintainability in the long-run.</li>
</ul>
<p>Due to its drawbacks in the application of extracting data form user agent strings, the brute force approach will not be discussed further in this article.</p>
<h4>Pattern recognition on the user agent string</h4>
<p>Check out <a href="http://www.texsoft.it/index.php?c=software&amp;m=sw.php.useragent&amp;l=it">Identify User Agent by string format recognition</a> for an example of user agent pattern recognition. Though a little outdated, the article provides additional depth, in addition to some useful programming techniques and lax copyright restrictions.</p>
<h3>User agent spoofing</h3>
<p>Impersonating browsers and mobile devices is simple with Firefox. Just download <a href="https://addons.mozilla.org/en-US/firefox/addon/59">User Agent Switcher</a> plug-in and put it to the test at <a href="http://www.useragentstring.com/">useragentstring.com</a>. See <a href="http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/">Web Development and Debugging Tools</a> for a list of tools useful for front end development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2009/07/22/analyzing-user-agent-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Better Lightbox</title>
		<link>http://www.habdas.org/2009/03/29/building-a-better-lightbox/</link>
		<comments>http://www.habdas.org/2009/03/29/building-a-better-lightbox/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 22:17:02 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[best practice]]></category>
		<category><![CDATA[focus management]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Lightbox]]></category>
		<category><![CDATA[UI design]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=375</guid>
		<description><![CDATA[Though modal dialogs are not a new concept in UI design, the number of homegrown Lightbox clones appearing on the Web since major JavaScript libraries like Prototype and jQuery hit the scene has been staggering. Unfortunately, many of the clones developed leave some key usability considerations unaddressed, and struggle with common problems in accessibility. Some key [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1127" class="wp-caption alignright" style="width: 310px"><span class="colorbox"><img class="size-medium wp-image-1127 " title="Lightview Modal Dialog" src="http://www.habdas.org/wp-content/uploads/2009/03/lightview1-300x246.png" alt="Screenshot of a Lightview modal dialog" width="300" height="246" /></span><p class="wp-caption-text">Screenshot of a Lightview modal dialog</p></div>
<p>Though modal dialogs are not a new concept in UI design, the number of homegrown <a href="http://planetozh.com/projects/lightbox-clones/">Lightbox clones</a> appearing on the Web since major JavaScript libraries like Prototype and jQuery hit the scene has been staggering. Unfortunately, many of the clones developed leave some key usability considerations unaddressed, and struggle with common problems in accessibility.  Some key usability features that should be considered during creation of a Web-based modal dialog include (1) manage focus and allow tab navigation (2) disable elements outside the modal dialog (3) give users an out and (4) provide graceful error recovery.</p>
<p><span id="more-375"></span></p>
<h3>Manage focus and allow tab navigation</h3>
<p>Guide the user experience by managing focusable page elements using JavaScript.</p>
<ul>
<li>Tabbing should allow the user to navigate back to the browser&#8217;s location bar and other tabbable toolbars.</li>
<li>When the modal dialog is shown, the user should not be able to tab to document content outside the dialog content area.</li>
<li>When the dialog is hidden, focus should be restored to the initial element used to activate the modal dialog, the original tab ordering should be restored and the user should no longer be able to tab to content inside the modal dialog.</li>
</ul>
<h3>Disable elements outside the dialog</h3>
<p>Guide user interaction with page elements outside of the modal dialog and keep focus in the lightbox window.</p>
<ul>
<li>Display a translucent overlay above the page while the dialog is shown, giving the perception of modality while maintaining frame of reference to existing page content.</li>
<li>Prevent interaction with elements outside the modal dialog using script to do the following:
<ul>
<li>Save and then temporarily set a new tab order for all applicable elements;</li>
<li>Save and then temporarily set the disabled flag on all applicable elements; and</li>
<li>Save and then temporarily update applicable hyperlink click handlers to return false.</li>
</ul>
</li>
</ul>
<h3>Give users an easy way out</h3>
<p>Give users the ability to exit unwanted modal dialogs without thinking much about it.</p>
<ul>
<li>Use a graphical [x] link the user can click to initiate the hide method. In addition, consider using the graphic as a background image for a text-based link (e.g. &#8220;Close&#8221;) to help improve comprehensibility slightly for both sighted and non-sighted users while maintaining application scalability with a single link implementation.</li>
<li>While the dialog is displayed, listen for the [Esc] key. If it is pressed, exit the modal dialog and restore the previous display state.</li>
<li>If the Lightbox was activated by the user, make the close link the next focusable element in the tab order.</li>
</ul>
<h3>Provide graceful error recovery</h3>
<p>Script display methods (e.g. hide/show) should listen for script errors and, upon error, close the modal dialog and restore previous settings–including any previously focused element. Utilize the try/catch block to make it happen, but beware that suppressed errors increases debugging complexity.</p>
<h3>Related articles</h3>
<p>See also Roger Johansson&#8217;s <a href="http://www.456bereastreet.com/archive/200910/lightboxes_and_keyboard_accessibility/">Lightboxes and keyboard accessibility</a> for additional considerations in improving Lightbox usability, with a focus on keyboard accessibility.</p>
<h3>Recommended scripts</h3>
<ul>
<li><a href="http://colorpowered.com/colorbox/">ColorBox</a> — A light-weight, customizable lightbox plugin for jQuery</li>
<li><a href="http://www.nickstakenburg.com/projects/lightview/">Lightview</a> — Lightview was built to change the way you overlay content on a website</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2009/03/29/building-a-better-lightbox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Web Development and Debugging Tools</title>
		<link>http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/</link>
		<comments>http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 14:37:21 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browser compatibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[debugging tools]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[proxies]]></category>
		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=234</guid>
		<description><![CDATA[Following is a  list of cross-browser/platform web development and debugging tools useful for client-side developers. Depending on the application, one or all of these tools can be valuable in completing work on a website front-end. Tools for Firefox Build for standards. Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you [...]]]></description>
			<content:encoded><![CDATA[<p>Following is a  list of cross-browser/platform web development and debugging tools useful for client-side developers. Depending on the application, one or all of these tools can be valuable in completing work on a website front-end.</p>
<p><span id="more-234"></span></p>
<h3>Tools for Firefox</h3>
<p>Build for standards.</p>
<div id="attachment_1295" class="wp-caption alignright" style="width: 303px"><a href="http://www.habdas.org/wp-content/uploads/2009/01/firebug-logo.png"><img class="size-full wp-image-1295" title="Firebug Logo" src="http://www.habdas.org/wp-content/uploads/2009/01/firebug-logo.png" alt="Product Logo" width="293" height="89" /></a><p class="wp-caption-text">Firebug &gt; *</p></div>
<ul>
<li><a href="http://getfirebug.com/">Firebug</a> integrates with Firefox to put a wealth of development tools at your fingertips while you browse.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/249">HTML Validator</a> is a Mozilla extension that adds HTML validation inside Firefox and Mozilla.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer</a> adds a menu and a toolbar with various web developer tools.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1419">IE Tab</a>, an extension from Taiwan, embeds Internet Explorer in a Mozilla/Firefox tab.</li>
<li><a href="http://www.colorzilla.com/">ColorZilla</a> provides Advanced Eyedropper, Color Picker, Palette Viewer and other colorful goodies for your Firefox.</li>
<li><a href="http://developer.yahoo.com/yslow/">YSlow</a> analyzes web pages and tells you why they&#8217;re slow.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/6647">HttpFox</a> monitors and analyzes all incoming and outgoing HTTP traffic between the browser and the web servers.</li>
<li><a href="http://davemartorana.com/multifirefox/">MultiFirefox </a>is a small launcher utility that allows you to run multiple versions of Firefox side-by-side.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/59">User Agent Switcher</a> to spoof user agent strings for browser support testing.</li>
<li><a href="http://www.google.com/toolbar/">Google Toolbar</a> to visualize Page Rank.</li>
</ul>
<h3>Tools for Internet Explorer</h3>
<p>Ensure application compatibility.</p>
<ul>
<li><a href="http://www.microsoft.com/downloadS/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&amp;displaylang=en">Internet Explorer Developer Toolbar</a> provides a variety of tools for quickly creating, understanding, and troubleshooting Web pages. It also allows for the inspection of the MSIE-specific CSS passed in through the use of <a href="http://msdn.microsoft.com/en-us/library/ms537512.aspx">Conditional Comments</a>.</li>
<li>A look-alike is just that, not the real thing. Here are the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&amp;displaylang=en">Internet Explorer Application Compatibility VPC Images,</a> made available by Microsoft for use in testing browser compatibility with MSIE.</li>
</ul>
<h3>Other tools</h3>
<p>Polish it to a bright shine.</p>
<ul>
<li><a href="http://seleniumhq.org/projects/ide/">Selenium IDE</a> for automated testing, helping unlock the potential for test-driven development in the UI layer.</li>
<li><a href="http://www.parosproxy.org/">Paros</a> is a simplistic proxy tool that allows you to trap raw HTTP request and response headers for analysis and testing.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
