Firefox Extension for Turning Built-in SVG on and off

So, as I was saying yesterday, I wrote a simple Firefox extension that just turns the about:config preference for svg.enabled on or off.

Read on to download it.

How to install it
Click here. You'll probably have to tell Firefox that it's okay to install software from my site before it will install for you. Then restart Firefox (as with any extension).

How to use it

It's a button with a dropdown arrow, like the browser back button. The main button shows the current state of the svg.enabled preference. It has to be clicked once before it shows the state correctly. Click it to toggle. It has clear label and tooltip text as well in case the ugly icons aren't clear enough. Click the drop down arrow and you get an option to set it to true (enabled) or false (disabled). The drop down also has a link to navigate to SVG Basics and the SVG 1.1 specification.

Customizing
If you don't like having a toolbar with just the one button on it (and I don't), then you can right-click the default Firefox toolbar and choose "Customize..." You'll get a palette of toolbar buttons you can drag on to the default toolbar. One of them is added by this extension, it starts with the label "Built-in SVG" but that changes to reflect the state of the preference. Drag the button to the toolbar of your choice and click "Done." After that, right-click the default Firefox toolbar and uncheck the SVG Prefs Toolbar toolbar to hide it.

Regular use
When svg.enabled is false, Firefox Deer Park Alpha 1.1 won't try to render SVG content. This means embedded SVG tags as well as SVG documents referenced by the <object> or <embed> tags. If you're already on a page that uses SVG, you'll have to refresh or reload (press F5 or Contrl-R in Windows) to see the effect.

If you have another way to render SVG (that would be Adobe SVG Viewer or another plugin installed), then the plugin will get a chance to render the SVG. A plugin will only work for SVG included as a document. This means you can view pages that use the <object> or <embed> tags to include SVG documents. Inline SVG can't be rendered by a plugin. To see compound documents like those, you can use the built-in rendering. I'd expect that for now, I'll normally be using ASV and in time I'll be using the built-in rendering a lot more. Hopefully this extension will be totally useless soon :) .

You will need a plug-in to render SVG when svg.enabled is set to false.

How I made it
I work in a total vacuum and all the knowledge just sprang into my head spontaneously. Okay, maybe that happened right after I read the excellent tutorial on how to make a Firefox extension over at Born Geek.

I used the same structure described there, starting out by building the Google Toolbar Lite extension with a batch file and 7zip. Then I replaced all the parts that needed replacing and removed all the parts that needed removing. I made my really ugly button icons in the Gimp and I edit my source with Textpad.

With 7 zip, I had to set the file type (zip, as opposed to 7zip, gzip or others) and I also told it to use no compression, though I'm not sure if I could have let it compress just a little. Here's my build batch file, with no error handling.

cd chrome
7za u -tzip -mm=Copy svgimpltoggle.jar @jarzip.txt
cd ..
7za u -tzip -mm=Copy svgimpltoggle.xpi @xpizip.txt

jarzip.txt and xpizip.txt are exactly as described at Born Geek.

You can have a look inside my XPI to see how I did it by just unzipping it all and opening it in a text editor. Both the XPI and the JAR inside the XPI can be opened by 7zip, Winzip or lots of other tools.

Extension Reference Material
I found a lot of good references while working on this. Most of them I've already called out, but XULPlanet has a lot of good reference material. I also had a quick look at the source code where the preference is used in Firefox.

Why I Made This
I explained this yesterday, but I know I might not come across very clearly. As much as I like Firefox, I'm trying to promote SVG. SVG is more than a feature of Firefox.

For Developers
To encourage SVG developers to support the widest audience, I thought it would be nice to be able to quickly test on ASV and Firefox. Adobe SVG Viewer will generally look the same on Internet Explorer as it does on Firefox, so I think of this as a nice shortcut.

For Surfers that are Early Adopters
As a user, I'd like things to just work. If I have to go toggle a setting in about:config then I might do it once and forget about it. If there's some set up work but then just a simple button to click to see if a site will work, I'll do that.

For Me
I like the idea of being able to customize Firefox and I'd read about XUL here and there, so it was nice to finally have a really really simple project to play with. Who knows, maybe I can add tools to it later to do something more useful. Really, any boolean user preference could easily be controlled with an extension just like this. If you want to, go ahead. Just tell me about it, I'd like to hear.

0
Your rating: None

Hello. Thanks for this. I'm using DeerPark alpha 2 with you extension. I notice that the drop-down enable/disable choices on your extenstion actually do the opposite of what they say. Enable disables and vice-versa. Weird.

I didn't find this was the case. Can you be clearer about what seems to be the confusion? For instance, when SVG is disabled (red/pink circle), I don't see any SVG and when I hover the mouse cursor over this button it says "Built-in SVG is currently disabled, click to enable". This is pretty clear to me anyway...

I'm using Firefox 1.5 rc1

The "SVG enabled" and "SVG disabled" state is correct as mentioned by Jeff.

But Amos is correct that the drop down options are the wrong way around, no major problem, I can't imagine anyone using the drop down options when they can just click the button !

Hi Chris, I thought I tested it out as soon as I saw the comment from Amos. I must've missed something... I'll have a look when I get a free minute. It's a silly bug to have in such a simple extension :-/

[...] - As many of you knows, to view an SVG file with Firefox is needed the installation of this plugin after this instructions. Or to download Firefox 1.1 (update: now 1.5) with native support, already disponible in alpha under Deer Park Alpha 1 war name. To continue to utilize this plugin with this version too, svg.org suggest an extention that,setting the svg.enabled in Deer Park&#8217;s about:config allow to disable the SVG plugin inside it. If you want to know my two cents, I advise to use the good old plugin, and if you to test it after installing, you can click in KevLinDev samples, or to see this worldmap, Treebuilder or Galactic Pathways. [...]

Hi,

Thnaks for your nice FF extension. Can you maybe update it to allow the latest FF version (1.5.0.1).

Thanks

Glad you like it Vic, it should work with Fx 1.5.0.1 already. If it doesn't work for you, have a look at the comments here and let me know if it still doesn't go.

Hi,

It doesn't seem to work with the latest version of Firefox, as the version's mismatch. Could you re-release with a higher (max?) version number? Firefox refuses to install it, even while it may work perfectly.

Thanks for the info, I found out that svg:enabled existed because of this page. I then turned it off, and the adobe plugin started working (using http://genewindow.nci.nih.gov). I need the latest from Adobe in order for the web site to work. Perhaps the built-in svg isn't such a good idea until Adobe stops supporting svg?

It's a tough situation that SVG is in right now. Some pages were designed to work specifically with the Adobe SVG Viewer and might even rely on functionality that isn't (and never will be) in the official spec. ASV did do a good job of getting a great implementation out there but since it hasn't been maintained for years and isn't quite complete people are mostly better off with the native browser implementations in Firefox and Opera - especially for new development.

Still, the fact that there are working apps out there that require ASV makes the svg.enabled flag a very helpful feature for the people who rely on those applications.