maybe you should try to include the script in module.gwt.xml file instead ?
On Sun, Mar 13, 2011 at 8:27 PM, Simon M <[email protected]> wrote: > I try to integrate with Facebook. I want to load the javascript file from > Facebook dynamically. > > I created the following method to load the js file and then initialize FB: > > private native void initFacebook(String fbAppId) /*-{ > var script = document.createElement("script"); > script.src = "http://connect.facebook.net/en_US/all.js"; > script.type = "text/javascript"; > $doc.getElementsByTagName("head")[0].appendChild(script); > var fbroot = document.createElement('div'); > fbroot.setAttribute('id', 'fb-root') > $doc.getElementsByTagName("body")[0].appendChild(fbroot); > > FB.init({ > appId : fbAppId, > status : true, // check login status > cookie : true, // enable cookies to allow the server to access the > session > xfbml : true // parse XFBML > }); > }-*/; > > But the FB object is not found : > > at java.lang.Thread.run(Thread.java:619) > Caused by: com.google.gwt.core.client.JavaScriptException: > (ReferenceError): FB is not defined > > (I tried also with $wnd.FB without success) > > Any idea ? > > -- > 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. > -- 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.
