xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Roland.Webe...@t-systems.com>
Subject Batik and XmlHttpRequest / accessing Batik objects from javascript in svg
Date Fri, 17 Sep 2010 12:45:30 GMT
Hi all,

this is my first post to this mailing list and I’m new to Batik and SVG ☺

My situation is as follows: I got an existing intranet application that uses SVG for a complex
graph/workfloweditor. Currently this is running fine in IE 6+ IE 8 using the Adobe SVG Viewer
Plugin 3.0. As support for this plugin has ended quite some time ago, my task is to find a
suitable replacement and I stumpled across Batik which I find to be very powerful indeed.

However, I got 2 main problems in getting my existing SVGs run in an Applet with JSVGCanvas:

1) The Adobe Plugin is currently embedded into an HTML page via the embed-tag. This enables
all scripts in the SVGs to access all Html-Elements/Javascripts  from the OUTER HTML page
and vice versa. That means I can define a Javascript object in a script block on the HTML
and use it inside the Javascript of the SVG out of the box. Or for example I can get hold
of a DIV-Element from the outer HTML page by calling something like


from within javscript inside SVG.

No discussion on whether this is a good design or concept – fact is, that the Javascript
in the existing SVGs heavily relies on Javascript blocks and Elements of the surrounding HTML
page. My question is: Is there a way to achieve the same effect when using an Applet with
JSVGCanvas to display the SVGs? Probably not.

However, I could surpass this by calling a method from my Applet from inside the SVG's Javascript
(as I can get hold of Elements of the HTML page from my Applet). The question is: How to access
The JSVGCanvas or the Applet object from javascript within SVG? Is there a way, maybe via
the Rhino engine?

2) A related problem is the current communication. Within the Adobe plugin, I can access the
browsers XmlHttpRequest object and use it for ajax-like communication from within the SVG.
This doesn't work within the Applet with JSVGCanvas. Isn't there something like a lightweight
XmlHttpRequest object available in Batik? If not, would it be possible to call some Java code
from within the SVGs Javascript to build some similar communication and how does this work?
Would security settings deny this (can't use signed Applets) if I only would connect to the
same server/codedbase? Ajax-like communication within the svg is awesome, it makes the graph/workfloweditor
quite fast with the Adobe Plugin - this would be a point Batik could really benefit from when
it comes to developer and customer acceptance!

Many thanks in advance for any helping comments on these problems.

View raw message