<?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; JavaScript</title>
	<atom:link href="http://www.habdas.org/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.habdas.org</link>
	<description>A tech blog by Josh Habdas</description>
	<lastBuildDate>Sat, 04 Feb 2012 21:23:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>JSONView for Google Chrome</title>
		<link>http://www.habdas.org/2012/01/25/jsonview-google-chrome-extension/</link>
		<comments>http://www.habdas.org/2012/01/25/jsonview-google-chrome-extension/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 06:37:41 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[debugging tools]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=2008</guid>
		<description><![CDATA[Learned about the JSONView Google Chrome extension. A handy tool for viewing formatted JSON data in the browser. There&#8217;s also an add-on for Firefox.]]></description>
			<content:encoded><![CDATA[<p>Learned about the <a href="https://chrome.google.com/webstore/detail/chklaanhfefbnpoihckbnefhakgolnmc">JSONView Google Chrome extension</a>. A handy tool for viewing formatted JSON data in the browser. There&#8217;s also an add-on for Firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2012/01/25/jsonview-google-chrome-extension/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[Software Engineering]]></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 &#8230; <a href="http://www.habdas.org/2009/07/22/analyzing-user-agent-strings/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></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>
<h2>Collecting user agent strings</h2>
<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>
<h2>Data extraction methods</h2>
<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><a href="#pattern-recognition">pattern recognition</a></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>
<h3 id="pattern-recognition">Pattern recognition on the user agent string</h3>
<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>
<h2>User agent spoofing</h2>
<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.<br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-0082825360919078";
/* habdas.org banner ad */
google_ad_slot = "2440223718";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></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[Software Engineering]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[focus management]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[modal dialog]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[UX]]></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 &#8230; <a href="http://www.habdas.org/2009/03/29/building-a-better-lightbox/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_1127" class="wp-caption alignright" style="width: 310px"><span class="colorbox"><a onclick="_gaq.push(['_trackEvent', 'widget-colorbox', 'Lightbox', 'Image click on the Lightbox post']);" href="http://www.habdas.org/wp-content/uploads/2009/03/lightview1.png"><img class="size-medium wp-image-1127   colorbox-375" 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" /></a></span><p class="wp-caption-text">Screenshot of a Lightview modal dialog</p></div>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>
<h2>Manage focus and allow tab navigation</h2>
<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>
<h2>Disable elements outside the dialog</h2>
<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>
<h2>Give users an easy way out</h2>
<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>
<h2>Provide graceful error recovery</h2>
<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>
<h2>Related articles</h2>
<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>
<h2>Recommended scripts</h2>
<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>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-0082825360919078";
/* habdas.org banner ad */
google_ad_slot = "2440223718";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></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[Software Engineering]]></category>
		<category><![CDATA[browser compatibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[debugging tools]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[html5]]></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 and Chrome Build for &#8230; <a href="http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></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>
<h2>Tools for Firefox and Chrome</h2>
<p>Build for standards.</p>
<ul>
<li><a href="http://www.google.com/chrome/">Chrome</a> includes a powerful set of development tools out of the box, including remote debugging.</li>
<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/html-validator/">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/web-developer/">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. Handy but doesn&#8217;t work on a Mac.</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 (Mac only).</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="https://addons.mozilla.org/en-US/firefox/addon/fangs-screen-reader-emulator/">Fangs</a> renders a text version of a web page similar to how a screen reader would read it.</li>
<li><a href="http://www.google.com/toolbar/">Google Toolbar</a> to visualize Page Rank.</li>
</ul>
<h2>Tools for Internet Explorer</h2>
<p>Ensure application compatibility.</p>
<ul>
<li><a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=95e06cbe-4940-4218-b75d-b8856fced535">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>
<li><a href="http://www.httpwatch.com/">HttpWatch</a> is a tool for monitoring HTTP traffic in IE.</li>
</ul>
<h2>Performance &amp; Testing</h2>
<p>Polish it to a bright shine.</p>
<ul>
<li><a href="http://www.jslint.com/">JSLint</a> helps in checking how bad your script sucks. Just copy/paste and pray.</li>
<li><a href="http://www.webpagetest.org/">WebPagetest</a> will help access how slow your site is once it&#8217;s built.</li>
<li><a href="http://html5.validator.nu/">Validator.nu (X)HTML5 Validator</a> validates HTML5.</li>
<li><a href="http://gsnedders.html5.org/outliner/">HTML5 outliner</a> provides an easy to use document outline.</li>
<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>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.habdas.org @ 2012-02-05 00:31:31 -->
