WWW

Why Google Analytics (”ga.js”) Doesn’t Work with XHTML

Posted by Mike Brittain on September 13, 2008
WWW / 1 Comment

Finding a small issue with Google Analytics’ tracking code when served on pages with the application/xhtml+xml mime-type… It doesn’t work.

The issue is that the code checks the current HTTP protocol for the page, whether it is served as SSL or not.  If it is, the tracking code is served from a secure server to prevent your browser from complaining.  The actual tracking code is loaded using a script that uses a document.write() operation to add the script tag to your page.  This is illegal on pages served as XML, because the browser (at least Firefox) is designed to restrict JavaScript from inserting markup during render time.

This probably affects only the “latest” tracking code, ga.js, and not the legacy code, urchin.js.

The fix is actually pretty easy, despite the fact that I couldn’t find any official documentation about it from Google.  Take a look at the legacy code for inserting urchin.js on your page.  It uses a normal script tag, instead of using document.write() to insert the tag — which is legal.

Now look at the JS code used to insert ga.js.  Assuming you’re not serving an SSL site, you can replace the document.write() with a static script tag.  Something like the one below:

<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>

If you are using SSL on your site, along with the application/xhtml+xml mime-type, then it’s up to you to deal with switching the hostname and protocol in the URL in the appropriate pages.

You should not make this change to the tracking code unless you need to (i.e. you’re serving XHTML and tracking pixels are not firing properly).

Tags: , , ,

Making Application Shortcuts for Chrome

Posted by Mike Brittain on September 09, 2008
Google, WWW / No Comments

Google has a page listing some details for webmasters about their new web browser.  My favorite part is in regards to handling application shortcuts which I figured out from Gmail’s site.  It’s a simple addition of “application-name” and “application-url” meta tags, along with a meta description and link to an icon file, which you probably already have on your site.

Application shortcuts are probably my favorite feature of Chrome, and the reason why I think that it is an important browser.  These shortcuts will help users and businesses to change their mindset about software-as-a-service applications.  They make web applications look like real software.  We used to have a desktop icon for Eudora or Outlook Express.  Now we have one for Gmail.  In the future, I suspect we’ll see more people replacing their installations of Microsoft Office with a shortcut to Google Docs, Zoho, ThinkFree, or Live Workspace.

Tags: , , , ,

What I think about Google Chrome

Posted by Mike Brittain on September 09, 2008
WWW / No Comments

I didn’t feel like posting an entry about Chrome, but I’ve had a lot of opinions about why I think it’s good.  Will I use it as?  That’s a good question.  We’ll need a Mac version, first, but I think I’d like to make the transition.

Anyway, Felix wrote a pretty good post about Chrome, and I decided to just add my thoughts on the end of that one.

Tags: , , ,

How to Setup a Web Proxy for the iPhone Simulator

Posted by Mike Brittain on September 04, 2008
WWW / No Comments

I have been trying to get a better view of how the iPhone makes use of certain HTTP headers.  When developing with Firefox, I usually turn on my Charles Proxy or enable a extension for watching headers, like livehttpheaders.  Fooling around with the iPhone simulator, I couldn’t find any obvious preference settings.  I also dug around with the “defaults” utility in OS X, but only came up with the following keys:

mikebrittain$ defaults read com.apple.iPhoneSimulator
{
"NSWindow Frame iPhoneSimulatorWindow" = "287 10 386 742 0 0 1280 778 ";
windowOrientation = 1;
}

So I took a closer look at Charles to see if there was a solution in there.  I was surprised to find that this is actually very easy to do.  Under the Proxy menu, there’s an option for Mac OS X Proxy.  Enabling that seems to make it possible to have all HTTP traffic proxied through Charles.

Are there other solutions I’m missing?

Tags: , , , , ,

I like Google Chrome

Posted by Mike Brittain on September 04, 2008
WWW / Comments Off

I like Google Chrome.  I think there’s a lot of good stuff going on in that project, even if it doesn’t become a mainstream browser.  I had a lot of thoughts about the direction Google is taking with Chrome, and Felix seemed to touch on a lot of them his post about Chrome, so I just tacked on some of my thoughts the end of that.

Tags: , ,

Back to Dreamhost

Posted by Mike Brittain on September 02, 2008
WWW / No Comments

It took me a few months running my blog on WordPress before I decided that I’d like to have a little more control over the layout and plugins.  Tonight I moved back to Dreamhost which allows for pretty simple installation, and allows any customizations I want to make.

Nothing bad to say about WordPress, however.  I love the software, and the hosted solution is fantastic if you don’t have your own hosting account elsewhere.

I’ve been a Dreamhost customer for many years now.  I’m not surprised that I ended up switching my blog site back over.

Tags: ,

Lost Opportunity for CDN Promotion

Posted by Mike Brittain on June 17, 2008
WWW / No Comments

Today, Firefox 3 is released to the public.  The Mozilla organization decided to shoot for a Guinness World Record for most downloads in a single day.  So far, it’s anyone’s guess whether they’re on track to reach that goal.  The site has been unreachable during the last hour.

This might have been a great opportunity for one of the big CDNs, or even one of the smaller ones, to jump on board with some pro-bono hosting in order to get some publicity related to this launch.

Tags:

Traffic Reports via Twitter

Posted by Mike Brittain on May 19, 2008
WWW / No Comments

Just came across this Twitter feed by accident (no pun intended)… Boston is apparently using Twitter feeds to broadcast messages about traffic conditions in the area.

I wonder who else is doing this?  I don’t have time at the moment to check in on others, but this is really interesting in terms of what other public information could be broadcast in this way.

Tags:

Translate Words From Your BlackBerry or Opera Mini Browser

Posted by Mike Brittain on May 17, 2008
Mobile, WWW / No Comments

I recently released a web application for use on iPhones for language translation while on the go. Enter a word or phrase and instantly get a translation into another language. Seems like it’d be a great tool for travelers and students, especially.

Today, I have added support for the BlackBerry and Opera Mini web browsers. Just point your mobile phone at this address to get started:

http://m.mikebrittain.com/tr

Lots of Dutch Visitors Using my iPhone Translator App

Posted by Mike Brittain on April 30, 2008
Mobile, Personal, WWW / No Comments

I just wanted to say hello and thanks to the guys at iPhoneclub.nl for their coverage of the iPhone Translator app that I wrote last weekend. It looked like a good article, from what limited amount I could understand, and they even took a few nice screen shots of words being translated to Arabic and Korean.

I was surprised to find this week that Dutch users account for the majority of traffic to the app, and it appears (from web accesses to the home screen icon) that people are bookmarking it for future use.

Hartelijk dank!

Tags: , , , , ,