Patch to SWFAddress for Gecko-based browsers (Iceweasel/Gran Paradiso/etc)
February 3rd, 2009
Here at Grooveshark, we’re using SWFAddress for deep linking/browser history support in our flagship product.
It’s been working great, except for one of our developers on Arch Linux using Gran Paradiso. We hadn’t been getting any user complaints, so that particular bug pretty much fell to the bottom of the stack. Until a few days ago, when we started get the same complaint from users on Debian/Iceweasel.
Now, since SWFAddress says that it officially supports Firefox v1 and up, I had pretty much assumed it would work fine on all Gecko browsers. In fact, since Iceweasel technically *is* Firefox (and wow, is the history behind *that* an interesting tale), there shouldn’t have been any reason for it to fail.
So off I went to poke about in the SWFAddress source, where I found that Firefox detection is made by matching the string ‘Firefox’ in the user-agent string. Also, when SWFAddress cannot identify the browser, it will refresh the page with the hash removed, which is probably a great fallback for a lot of Flash/Ajax sites, but winds up causing some problems for us.
Well Iceweasel doesn’t have ‘Firefox’ in it’s user agent string. It has ‘Iceweasel’ instead. Same with Gran Paradiso. So, I’ve written a patch for SWFAddress to fix the problem. If SWFAddress doesn’t match either Firefox or Camino (the two Gecko browsers that it officially supports), it will fall back on navigator.product to detect any other Gecko browser, regardless of what it calls itself in its user-agent string.
We’ve got it up live on http://listen.grooveshark.com now, and it seems to be working fine.
I’m going to email asual to see if it can get added to the actual trunk, but in the meantime, if you’re using SWFAddress and would like to use my patch, you can grab it here SWFAddress Gecko Patch.
Just check out the SWFAddress trunk at https://swfaddress.svn.sourceforge.net/svnroot/swfaddress/trunk. I wrote the patch off of Revision 702.
EDIT
So my first version of this didn’t work in Chrome/Safari. Apparently WebKit reports its navigator.product as “Gecko” despite the fact that it’s, you know, WEBKIT. I’ve uploaded a new version of the patch, so if you grabbed it before 11:20 am eastern on Feb 4, grab it again for the fix.
June 22nd, 2009 at 1:52 pm
Hi Katy,
Ran across your post looking for swfaddress support under Safari 4 final and Mac OS X. The issue I am seeing is the the address bar does not update when the hash is appended unless you manipulate the GUI to manually refresh (changing back and forth between tabs works). This seems to be the same for grooveshark and I was wondering if you had any thoughts on patching from your work to support Gecko browsers.
Cheers,
-Koof