I have found that there are lots of timing issues with different browsers. The onload handler on the HTML side gets invoked when the HTML file has "fully loaded", but that does not necessarily mean its "images" included SVG images referenced by OBJECT, EMBED or IFRAME have been loaded yet. Because of this, the HTML onload handler might be getting invoked before the SVG file has been loaded.
Instead, what you should try: (1) Use OBJECT instead of EMBED because OBJECT is the officially sanctioned element and is supported everywhere that SVG is supported natively, and because it is officially supported, you are more likely to find accurate specifications (2) Put an onload handler on the OBJECT tag for the SVG. This handler will get invoked when the SVG has successfully loaded. (3) Call getSVGDocument() in the onload handler for the OBJECT tag Jon Ferraiolo --- In [email protected], Oliver Boermans <boermans@...> wrote: > > On 13 July 2011 13:21, gmcaulee <gmcauley@...> wrote: > > <script type="text/javascript"><![CDATA[ > > > > function sayHello() { > > alert("Hello from test.svg!!!"); > > } > > > > // ]]></script> > > It's similar to working between an iframe and the containing document. > You can expose the function in the parent document. You can do this directly. > > // the HTML - Create an object before the svg loads > var svg = {}; > > // test.svg - assign your function to that object > parent.svg.sayHello = function() { > alert("Hello from test.svg!!!"); > } > > // Once the SVG is loaded you can call it from the HTML > svg.sayHello(); > > Actually looking back at my code I notice I define the object in the > parent document taking care to not overwrite it if it already exists: > var svg = svg?svg: {}; > > I don't remember exactly how that might be necessary. Maybe the timing > of the loading of the svg was unreliable. > > HTH > > Ollie > -- > @ollicle > ------------------------------------ ----- To unsubscribe send a message to: [email protected] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

