Opera SVG Support

After hearing about the Opera 9 release, I decided it was time I revisited the SVG content on this site to make sure it’s working with the latest browser-based SVG implementations. I started this round of updates with Opera as my target UA and I have been pleasantly surprised. Many of the samples worked and most of the ones that didn’t only needed a bit of tweaking.

Many of the problems were old remnants from the ASV 2.0 days that somehow survived all my past updates: using getFirstChild() instead of firstChild, setting the MIME type to image/xml-svg, etc. However, the biggest blocks of trouble were with my use of parseXML, printNode and getURL. Special thanks to Doug Schepers for sharing a snippet of code to bring parseXML and printNode to Opera and Firefox; that saved me a fair bit of rewriting. I replace getURL with much more in vogue XMLHttpRequest. Special thanks to Jim Ley for his page dicussing various uses of that object.

Not everything is working in Opera and I even managed to crash the browser in one case. Some samples like the games and textbox require keyboard input. Key events are not yet in a W3C specification, so I’m not sure how those samples can be updated. In other cases, I used ASV’s sound extensions so I’ll have to see if there are any good replacements there. However, all in all, Opera is looking very promising. Next week, I’ll take a look at Firefox.

8 Responses to “Opera SVG Support”

  1. Something Witty Goes Here » Blog Archive » SVG News Digest 2006-07-31 Says:

    […] Kevin Lindsey gives an overall thumbs-up for Opera 9 support of SVG, updating his site’s experiments so that they work in Opera 9. […]

  2. Niklas Bäckman Says:

    Opera does not seem to support changing the “xlink:href” attribute of elements dynamically via ECMAScript. Well, it ‘works’, but the SVG image is not updated. This works in Firefox and ASV.

  3. Erik Dahlström Says:

    Nicklas: what version+buildnumber of Opera are you using? Please provide a testcase/bugreport at http://bugs.opera.com/wizard.

  4. Niklas Bäckman Says:

    Seems I was mistaken regarding Opera. It just requires you to
    use setAttributeNS(’http://www.w3.org/1999/xlink’, ‘href’, str)
    instead of setAttribute(”xlink:href”, str).

  5. Thelonious Says:

    Hi Niklas,

    Oh yes. Code snippets help a lot. Even though it is a bit more verbose, I decided years ago to always use all the *NS methods in place of the non-namespace equivalents. It’s a bit more verbose, but it is definitely safer, imho.

  6. wwwtiger Says:

    Could you share the parseXML for firefox? I met the problem of transplant SVG code from ASV to FIREFOX, and I did not found the code in SVG Whiz.
    Thank you.

  7. Thelonious Says:

    You can download my snippet here: http://www.kevlindev.com/common/PrintAndParse.js

  8. wwwtiger Says:

    Thanks a lot.