protovis compatibility in internet explorer

Modernizr

The simplest method is to use Modernizr, a very small JavaScript library similar to Protovis. Modernizr runs a test to see if a browser is able to render SVG. This is better than the blunt tool that is simple browser detection.

If the browser can render svg, the Protovis code renders. If it doesn't, you can replace the Protovis chart with a fallback. In this case, we'll us an image.

Download Modernizr and upload it to your server.

Now, load the Modernizr library by calling your script between the head tags.

Go to the Protovis script in the body of your page. Add the following Modernizr code directly after the opening script tag so that it looks like this:

Now go to the bottom of the script and add the following after the render command but before the closing script tag. It should look like this:

Download the example files if you want to see it in action.