Working around Firefox 1.5's SVG target problems (Sure it's simple, but it takes hours to try all the other hacks...)


Cinemon, as some of you may know, uses SVG graphics as one of its core navigational mechanisms. Until today we've basically had to have users use either the Adobe SVG viewer or be annoyed by the Mozilla browsers loading the whole site into the iframe where the navigation graphic is displayed. This is because Mozilla ignores the "target" tag on the SVG "a" element (which we want to set to _top)... duh!

So, today I decided that had to be fixed (Firefox 1.5 having been out for a while and doing a fine job in most other respects with the SVG we produce). There are a number of variations on the same hack-theme to get around the problem, but I couldn't get any of the onclick-handler based ones to work (and I burned quite a bit of time trying).

What did eventually work is using a javascript URL for the a element's href. That works in both Adobe SVG and Firefox 1.5 and though it's ugly as sin, it's functional. To be concrete, the code looks like this:

<a xlink:href="javascript:window.top.location.href='%(object_url)s'" xlink:title="%(object_name)s" target="_top">%%s</a>

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.