views:

216

answers:

1

I am using GWT and google maps. I created a custom infowindow which contains a script that will send an http request to twitter for the most recent tweets. i want to display this content inside a tab of the infowindow, but it is only working as expected in firefox. I suspect that this may be the case because IE and Chrome need to know about the content of the div earlier than firefox. heres the code that isnt being executed in ie or chrome:

        HTML recentTweets = new HTML(
        "<body>"+
        "<div style='color: #ffffff; background-color: #010101'>"+
        "<script type='text/javascript' src='http://twitter.com/javascripts/blogger.js'&gt;&lt;/script&gt;"+
        "<script type='text/javascript' src='http://twitter.com/statuses/user_timeline/stephenathome.json?callback=twitterCallback2&amp;amp;count=3'&gt;&lt;/script&gt;"+
        "</div>"+
        "</body>");

in ie, i will get an infowindow with

<script type='text/javascript' src='http://twitter.com/statuses/user_timeline/stephenathome.json?callback=twitterCallback2&amp;amp;count=3'&gt;

note that the end script tag isnt included. in chrome, the infowindow is blank. in firefox, the tweets display as expected.

is anyone familiar with a workaround?

+1  A: 

Put your script tags into the project's *.gwt.xml file. GWT will than handle the rest.

Something like this

<module>
       <inherits ... />
       <script src='http://twitter.com/statuses/user_timeline/stephenathome.json?callback=twitterCallback2&amp;amp;count=3'&gt;        
</module>
Drejc
thanks for the tip, i will try this right now.i dont know how helpful it will be in the end though because the script src is generated dynamically. do you see any way that i can work around that constraint? thanks so much!!
culov
If the script is dynamically created then I would suggest not to use a script at all. But instead make a classic GET request (from GWT code of course) to the desired URL and display the response in the window. PS: You might run into cross browser scripting problems, so check this before doing the final implemenation.
Drejc