Wednesday, February 26, 2014

Re: GWT and SVG, the 125th... :-)

But when call testSVG I get the following error:
com.google.gwt.core.client.JavaScriptException: (ReferenceError) @wgp.client.lib.GraphicsPanel::test()([]): SVG is not defined

You have added a <script> element to the browser's top window, but your GWT app runs inside an iframe. Inside that GWT iframe you can not access "SVG" directly, you have to write "$wnd.SVG". "$wnd" is created by GWT and always points to the browsers top window.

I think it is better to use GWT's ScriptInjector class instead of creating a <script> element yourself. ScriptInjector injects JavaScript code into the same iframe in which your GWT app runs by default. But you can tell ScriptInjector to inject to the top window if needed.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment