<?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>Karoshi Ethos &#187; SWFAddress</title>
	<atom:link href="http://karoshiethos.com/tag/swfaddress/feed/" rel="self" type="application/rss+xml" />
	<link>http://karoshiethos.com</link>
	<description>Navigating the treacherous waters of interactive technology</description>
	<lastBuildDate>Mon, 09 Aug 2010 15:23:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Vista&#8217;s Mail Suffers From Named Anchor Encoding Problems</title>
		<link>http://karoshiethos.com/2008/08/11/vistas-microsoft-mail-suffers-from-named-anchor-encoding-problems/</link>
		<comments>http://karoshiethos.com/2008/08/11/vistas-microsoft-mail-suffers-from-named-anchor-encoding-problems/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 02:20:20 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[Things that are broken]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[SWFAddress]]></category>
		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=77</guid>
		<description><![CDATA[One of my partners just informed me that Microsoft's Windows Mail that currently ships with Vista suffers from the same URI encoding issues that I discussed in a previous post.
"I have just discovered that the MS Mail client on Vista has the same problem as Apple Mail, when it comes to handling urls that include a "hash" component.  The [...]]]></description>
			<content:encoded><![CDATA[<p>One of my partners just informed me that Microsoft's <a href="http://www.microsoft.com/windows/windows-vista/features/mail.aspx?tabid=1&amp;catid=1" target="_blank">Windows Mail</a> that currently ships with <a href="http://www.microsoft.com/windows/windows-vista/" target="_blank">Vista</a> suffers from the same URI encoding issues that I discussed in a <a href="/2008/07/25/handling-urlencoded-swfaddress-links-with-mod_rewrite/">previous post.</a></p>
<blockquote><p>"I have just discovered that the MS Mail client on Vista has the same problem as Apple Mail, when it comes to handling urls that include a "hash" component.  The hash-sign gets url encoded before it is sent out to the browser, and so the browser thinks it's part of the url and sends it on to the server, rather than treating it as a hash.</p>
<p>I sent someone a link to the [***] stuff I did, and it got busted by their mail -- When I finally figured out what was happening, I had to pause briefly and confirm that they weren't using a Mac.</p>
<p>It's so simple it kills me... and MS and Apple are both supposed have the best minds in the world working on this stuff !?</p>
<p>If you ask me, this is pretty good proof that Vista is heavily based on on OSX (conceptually, that is).  I mean... they've even copied the bugs!"</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2008/08/11/vistas-microsoft-mail-suffers-from-named-anchor-encoding-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lazy developers, good libraries, and The 80/20 Rule</title>
		<link>http://karoshiethos.com/2008/07/31/lazy-developers-good-libraries-and-the-8020-rule/</link>
		<comments>http://karoshiethos.com/2008/07/31/lazy-developers-good-libraries-and-the-8020-rule/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 22:51:35 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Kung-Foo]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[SWFAddress]]></category>
		<category><![CDATA[SWFObject]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=59</guid>
		<description><![CDATA[I was searching for something or other related to SWFAddress the other day, and ran across a blog post talking about the launch of SWFObject2 and SWFAddress2, and how handy they were for building usable Flash sites. No surprises there, they are in fact very handy. What caught my attention was this comment on the [...]]]></description>
			<content:encoded><![CDATA[<p>I was searching for something or other related to <a href="http://www.asual.com/swfaddress/" target="_blank">SWFAddress</a> the other day, and ran across a blog post talking about the launch of <a href="http://blog.deconcept.com/swfobject/" target="_blank">SWFObject2</a> and SWFAddress2, and how handy they were for building usable Flash sites. No surprises there, they are in fact very handy. What caught my attention was this comment on the post:</p>
<blockquote><p>"We were looking at SWF Address a while ago. While it’s very cool it was useless for what we wanted. By using HTML anchors (# in the URL) the deep links are only relevant to client side logic inside the browser (JavaScript, HTML and Flash).</p>
<p>If you serve HTML content generated server side, in addition to flash there is no way to extract the deep link from the URL (after the #) as it’s not passed to the server in the request!</p>
<p>I will be interested to see if they have updated this in the new version… and also see what changes have been made to SWFObject2, or swffix or whatever it’s called these days."</p></blockquote>
<p>I had to read that twice.</p>
<p>SWFAddress is not a solution for implementing multiple content types. It's purpose in life is to keep the browser informed about the user's movements within a rich application. It does that job very well. One of the things you can do with SWFAddress is implement <em>your own</em> solution for managing your URLs across multiple content types.</p>
<p><a href="http://karoshiethos.com/author/jon/">Jon</a> and I are just finishing up a big client site for which we have a nifty flash client and an SEO/Usability optimized HTML version of all content on the site. SWFAddress allowed us to maintain a similar URI structure for both, and a little bit of custom javascript handles the translation of SWFAddress URIs, which all start with # to the standard URIs, and vice-versa. SWFObject handles the embedding of the Flash client. It's a really simple solution that took less than an afternoon to prototype and refine into a production-ready solution. I'm not saying this to make myself out to be a bad-ass, it's just <strong>not rocket science</strong>. All it takes is a general understanding of how the tools work, and the willingness to craft your own solutions to your specific problems.</p>
<p>There are well built, elegant, open source libraries to do just about anything these days. The thing is, they're libraries, tools, not complete solutions. They will solve the tough 80% of your problem for you. It's up to you to do the last 20% and make the tool work for you. Enter the <a href="http://en.wikipedia.org/wiki/Pareto_principle" target="_blank">80/20 rule</a>, or, more specifically, the <a title="2080 concept" href="http://en.wikipedia.org/wiki/2080_%28software_concept%29" target="_blank">2080 concept</a>.</p>
<blockquote><p>The 20 missing percent of functionality will take up 80% of the build time.</p></blockquote>
<p>If you expect canned solutions to solve your problems 100%, you will constantly be disappointed, and, most likely, be building poor software. If you go into your project knowing that a tool you will rely on provides a limited set of functionality, and you will need to do devote time and energy to make it fit, you will be more likely to succeed.</p>
<blockquote><p>"There is something to be learned from a rainstorm. When meeting with a sudden shower, you try not to get wet and run quickly along the road. But doing such things as passing under the eaves of houses, you still get wet. When you are resolved from the beginning, you will not be perplexed, though you still get the same soaking. This understanding extends to everything."</p>
<p style="text-align: center;"><em>-Yamamoto Tsunemoto, <a href="http://en.wikipedia.org/wiki/Hagakure">Hagakure</a></em></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2008/07/31/lazy-developers-good-libraries-and-the-8020-rule/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling URLEncoded SWFAddress Links with mod_rewrite</title>
		<link>http://karoshiethos.com/2008/07/25/handling-urlencoded-swfaddress-links-with-mod_rewrite/</link>
		<comments>http://karoshiethos.com/2008/07/25/handling-urlencoded-swfaddress-links-with-mod_rewrite/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 17:25:08 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[Things that are broken]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[SWFAddress]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=3</guid>
		<description><![CDATA[OK, so browsers are not supposed to send named anchors (or anything after them) to the server. However, I noticed today that SWFAddress links like this:
http://example.com/#/portfolio/myClient/myProject
...when sent as plain text via email to an iPhone, get URL encoded when displayed in the mail client, so Safari receives the URL from Mail like this:
http://example.com/%23/portfolio/myClient/myProject
...and happily sends [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so browsers are not supposed to send named anchors (or anything after them) to the server. However, I noticed today that <strong><a href="http://www.asual.com/swfaddress/" target="_blank">SWFAddress</a></strong> links like this:</p>
<p>http://example.com/<strong>#</strong>/portfolio/myClient/myProject</p>
<p>...when sent as plain text via email to an <strong>iPhone</strong>, get URL encoded when displayed in the mail client, so Safari receives the URL from Mail like this:</p>
<p>http://example.com/<strong>%23</strong>/portfolio/myClient/myProject</p>
<p>...and happily sends the whole URI to the server, which looks for something to do with a path containing <strong>%23</strong>, and comes up with a 404.</p>
<p>This is a clear violation of URI <a href="http://www.rfc-editor.org/rfc/rfc3986.txt">RFC 3986</a>, which states:</p>
<blockquote><p><strong>2.2.  Reserved Characters</strong></p>
<p>URIs include components and subcomponents that are delimited by characters in the "reserved" set.  These characters are called "reserved" because they may (or may not) be defined as delimiters by the generic syntax, by each scheme-specific syntax, or by the implementation-specific syntax of a URI's dereferencing algorithm. <strong>If data for a URI component would conflict with a reserved character's purpose as a delimiter, then the conflicting data must be percent-encoded <span style="text-decoration: underline;"><em>before</em></span> the URI is formed.</strong></p>
<p>reserved    = gen-delims / sub-delims</p>
<p>gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"</p>
<p>sub-delims  = "!" / "$" / "&amp;" / "'" / "(" / ")"</p>
<p>/ "*" / "+" / "," / ";" / "="</p>
<p>The purpose of reserved characters is to provide a set of delimiting characters that are distinguishable from other data within a URI. <strong>URIs that differ in the replacement of a reserved character with its corresponding percent-encoded octet are not equivalent.</strong> Percent-encoding a reserved character, or decoding a percent-encoded octet that corresponds to a reserved character, will change how the URI is interpreted by most applications.  Thus, characters in the reserved set are protected from normalization and are therefore safe to be used by scheme-specific and producer-specific algorithms for delimiting data subcomponents within a URI</p></blockquote>
<p>Furthermore:</p>
<blockquote><p><strong>2.4.  When to Encode or Decode</strong></p>
<p>Under normal circumstances, the only time when octets within a URI are percent-encoded is during the process of producing the URI from its component parts.  This is when an implementation determines which of the reserved characters are to be used as subcomponent delimiters and which can be safely used as data.  <strong>Once produced, a URI is always in its percent-encoded form.</strong></p></blockquote>
<p>In other words, keep your dirty mitts off of my URI's!</p>
<p>I spent some time poking around in Apple Mail (full OS X version, not on the iPhone), and noticed that the Edit/Link/Add dialog <strong>does not allow named anchors in URLs!</strong> As soon as you enter a <strong>#</strong> in the dialog, the "OK" button is disabled.</p>
<p style="text-align: center;"><img src="http://karoshiethos.com/wp-content/uploads/2008/07/picture-24.png" alt="OK button enabled" /></p>
<p style="text-align: center;"><img title="picture-23" src="http://karoshiethos.com/wp-content/uploads/2008/07/picture-23.png" alt="OK button disabled" /></p>
<p>So clearly Apple is aware of the problem, but have yet to give us a good solution. This got me even more curious - I wanted to see how the iWork apps handle anchors. Turns out that <strong>Pages, Numbers, and Keynote '08 all encode anchors in URLs</strong> added via the hyperlink dialog! This means that we have a bigger problem than just the iPhone edge case, any links in documents produced using the iWork suite can potentially be malformed. For sites that make heavy use of SWFAddress, this is a huge problem.</p>
<p>I fired up MS Word 2004 for Mac, and was pleasantly surprised, it has <a title="MS Word Gets it Right" rel="lightbox" href="/wp-content/uploads/2008/07/picture-25.png">a fairly robust interface</a> for working with links that contain named anchors, which results in properly formed URLs.</p>
<p>So what can we do about this? On the server side, we can use <a href="http://httpd.apache.org/docs/2.2/rewrite/">mod_rewrite</a> to trap incoming URIs that contain <strong>%23</strong> (or an actual <strong>#</strong> if it comes in, even though it shouldn't), and basically redirect it right back to the client unencoded, so the browser can call the proper URI, and handle the named anchor appropriately.<br />
<code class="console">RewriteCond %{REQUEST_URI} ^(.*)?#(.*)  RewriteRule .+ %1#%2 [NE,R=301,L]</code><br />
The problem with that shotgun approach is that it will trigger the redirect for URIs that rightfully contain URL encoded hash marks. Consider this; your app displays news posts, and pulls the post data from the server using nice semantic URLs, like <strong>http://example.com/news/My+Post+Title</strong>. The first time you have a post with a title like "<strong>We are #1</strong>", you will be unable to access the data, as the server will receive a request for <strong>http://example.com/news/Were+are+%231</strong>, and send a redirect back to the browser to <strong>http://example.com/news/Were+are+#1</strong>, at which point your browser will fire off a new request for <strong>http://example.com/news/Were+are+</strong>, which will result in a 404. This will not do.</p>
<p>For browser based client apps that implement SWFAddress, we need a more surgical approach to detecting and redirecting URLs with bogus encoded anchor delimiters.</p>
<p>Here are some mod_rewrite rules for making this happen (<a href="http://httpd.apache.org/docs/2.2/rewrite/">mod_rewrite docs can be found here</a>)<strong>:</strong><br />
<code class="console">RewriteRule ^#(.*) /#$1 [NE,R=301,L]</code><br />
If your client app loads at the site root, and is only accessible from <strong>/</strong>, here is a simple solution. This traps and redirects URLs like http://mydomain.com/%23/some/stuff to http://mydomain.com/#/some/stuff<br />
<code class="console">RewriteRule ^path/to/my/app/loadpage.html#(.*)<br />
↵  /path/to/my/app/loadpage.html#$1 [NE,R=301,L]</code><br />
If your app is further down in the site structure, you can include the path to it, perhaps including an HTML page that loads it, if appropriate. http://mydomain.com/path/to/my/app/loadpage.html/%23/some/stuff to http://mydomain.com/path/to/my/app/loadpage.html/#/some/stuff<br />
<code class="console">RewriteRule ^path/to/my/app/(index\.html)?#(.*)<br />
↵  /path/to/my/app/index.html#$2 [NE,R=301,L]</code></p>
<p>If you're using an index page to load your client app, it may be accessed either by the path to the directory, or the full path including the file name. Putting an optional check for the file name cracks that nut.</p>
<p>Needless to say, this does nothing to help standard named anchors in HTML pages, it's just a band-aid for client apps that use SWFAddress. Apple really needs to address this issue, and I think it's safe to assume that there are other apps and services out there with the same problem.</p>
<p><strong>UPDATE:<br />
<span style="font-weight: normal;">One of my partners just informed me that Microsoft's <a href="http://www.microsoft.com/windows/windows-vista/features/mail.aspx?tabid=1&amp;catid=1" target="_blank">Windows Mail</a> that currently ships with <a href="http://www.microsoft.com/windows/windows-vista/" target="_blank">Vista</a> suffers from these same URI encoding issues!</span></strong></p>
<blockquote><p>"I have just discovered that the MS Mail client on Vista has the same problem as Apple Mail, when it comes to handling urls that include a "hash" component.  The hash-sign gets url encoded before it is sent out to the browser, and so the browser thinks it's part of the url and sends it on to the server, rather than treating it as a hash.</p>
<p>I sent someone a link to the *** stuff I did, and it got busted by their mail -- When I finally figured out what was happening, I had to pause briefly and confirm that they weren't using a Mac.</p>
<p>It's so simple it kills me... and MS and Apple are both supposed have the best minds in the world working on this stuff !?</p>
<p>If you ask me, this is pretty good proof that Vista is heavily based on on OSX (conceptually, that is).  I mean... they've even copied the bugs!"</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2008/07/25/handling-urlencoded-swfaddress-links-with-mod_rewrite/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
