Firefox and Google Visualization

A project I’m working, for a company in far-away London, has to do with reporting. But who knows which web browsers they prefer there? I certainly don’t, which is why I’ve been testing in Firefox, Chrome, Safari, Opera, and IE. To be honest, it’s just something i normally do.

And what’s a report without a few graphs? Probably boring!

I decided to use Google Visualization to generate the graphs. Not such a big deal, since I used it as recently as two posts ago.

But things didn’t go quite as I’d expected.

Being fairly reasonable, I started with a single graph. It displayed in Chrome, Safari, Opera, and IE, and everything was going well. But then I checked Firefox, and where the graph was meant to be there was a depressingly empty iframe. The graph didn’t show up at all in Firefox.

I went about figuring out why, so that I could fix it and for other reasons. There was testing, and even more testing, and I’m sure some lucky combination of logic and prayer. And now it works!

What the system does:

  1. A base page is loaded, complete with your choice of whose report you’d like to view
  2. Javascript ajaxs over that guy’s report dashboard, which is mostly made up of data range selector
  3. Javascript ajaxs over the graphs based on your range selection

These loads initially happen without the user’s direct input. The system stores their settings, and uses those to figure out what to load, or it loads based on the defaults. If a setting is changed, it retrieves everything after that in the list.

When the call to graph the data (which is received in step 3) took place in step 3, Firefox loaded an empty iframe.

When I moved it to a function returned in step 2, which triggered the retrieval of step 3 (in the ajax’s success handler) everything worked fine.

Weird, but works now!

There was another issue (unrelated to Google Visualization) that I came across in Opera and IE, but it was less strange and pretty easy to fix.