That error message doesn't look familiar. Where do you see the message? Are you running in development mode or web mode?
If you want to dynamically load the Google Maps API, you can use the gwt-google-apis maps library Maps.loadMapsApi() method: http://gwt-google-apis.googlecode.com/svn/javadoc/maps/1.1/com/google/gwt/maps/client/Maps.html or the AjaxLoader classs directly: http://gwt-google-apis.googlecode.com/svn/javadoc/ajaxloader/1.1/com/google/gwt/ajaxloader/client/AjaxLoader.html If you want to see how Maps.loadMapsApi to injects a script tag, take a look at the implementation of the AjaxLoader class. http://www.google.com/codesearch/p?hl=en#ow6Lmd7dcZY/trunk/ajaxloader/ajaxloader/src/com/google/gwt/ajaxloader/client/AjaxLoader.java It is pretty much the same, only it puts the script tag on the <BODY> element, and has logic to wait for the tag to be loaded by using a callback. On Wed, Aug 11, 2010 at 3:26 AM, Vincent COROLLEUR <[email protected]> wrote: > Hello, > > In my application, users can choose between two different map : google > map or OpenLayers. I'd like to load dynamically the chosen one by > loading the corresponding script (in this exemple google map). > > I tried this (in the EntryPoint) : > > ScriptElement script1 = Document.get().createScriptElement(); > script1.setType("text/javascript"); > script1.setSrc("http://maps.google.com/maps? > file=api&v=2&sensor=false&key=ABQIAAAApOR5tulUc5y1R6lOKFkbpRTwM0brOpm- > All5BF6PoaKBxRWWERTqbaRJ6lpQdSlaltvv3tD-fLXwvQ"); > > Document.get().getElementsByTagName("head").getItem(0).appendChild(script1); > > ScriptElement script2 = Document.get().createScriptElement(); > script2.setType("text/javascript"); > > script2.setSrc("http://mapstraction.googlecode.com/svn/trunk/source/ > mxn.js?(google)"); > > Document.get().getElementsByTagName("head").getItem(0).appendChild(script2); > > This code makes my application unloading... (message : "Unloading > module"). > > I don't understand the problem. Is there a way to realize this ? > > Vincent COROLLEUR > > > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- Eric Z. Ayers Google Web Toolkit, Atlanta, GA USA -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
