If the scripts can execute a function when they are finished loading,
you can use the script injection technique. Basically, you create a
script DOM element and attach it.  The catch is that you won't know
when the script is finished loading unless you wait for a function to
be executed by the script.

This patch to the gwt-google-apis project demonstrates how to do this in GWT:

http://galgwt-reviews.appspot.com/3604/show


On Mon, Feb 16, 2009 at 3:16 AM, Ghostcoder <thanneer.ma...@gmail.com> wrote:
>
> I have few JavaScripts (abt 35kb) getting downloaded at the beginning
> even thought it is used later in the app.Can i load javascript lazily
> with GWT apps.
>
> For example I use lightbox which will not be used at the beginning of
> the app ,so i can i download the GWT generated html first to build
> home page and then load then js files later when required .
>
>
> I have configured these js files in module.gwt.xml
>
>
>
> On Feb 15, 7:22 pm, Tóth Imre <tothi...@gmail.com> wrote:
>> I think 12  secs for 190 kb is too much  even if you  use a 512 kb/sec
>> connection. Int that case it would cost 4 secs. Maybe the script running to
>> much at startup, or you download too much images to the page...maybe..
>> byez
>>
>> 2009/2/14 Ghostcoder <thanneer.ma...@gmail.com>
>>
>>
>>
>>
>>
>> > Thanks for the reply .
>>
>> > I am compressing the html file(gzip) but my html file is 190 kb .It
>> > takes 12 secs to download.
>>
>> > Can I reduce the size by using multiple modules so that the initial
>> > page load can be quick and the subsequent module html files can be
>> > downloaded lazily.
>>
>> > Will multiple modules help me reduce load time if so is there any
>> > tutorial that explains how multiple modules can be used in one project
>> > (one website).
>>
>> > thanks
>>
>> > On Feb 12, 5:04 pm, Eric Ayers <zun...@google.com> wrote:
>> > > On Wed, Feb 11, 2009 at 3:34 PM, Ghostcoder <thanneer.ma...@gmail.com>
>> > wrote:
>>
>> > > > I have created my site using gwt1.5 and I have used gwt google map api
>> > > > too.When i open my site in the browser I realize that a main.js file
>> > > > is downloaded from maps.google.com. which is 68 kb(4 sec to download)
>> > > > and my cache html is 200kb(9 sec to download) so the site takes a
>> > > > while to load .These two files are not downloaded parallely even
>> > > > though they are from two different domains ,how do i configure it so
>> > > > that these two gets downloaded parallely.
>>
>> > > > note : I have configured the map script in module.gwt.xml
>>
>> > > One quick thing you could do is to move that script load out of the
>> > > module.xml and move it into the <head> section of your HTML host page.
>> > >  that will get the main.js file from maps up and running quickly.
>>
>> > > > How do i improve the startup time ,I verified with yslow ,it gives 80
>> > > > points for the site ,but still the start up time for the site when
>> > > > cache is empty is close to 15 secs which includes the files mentioned
>> > > > above ,my css and images.
>>
>> > > From a broadband connection (1.5Mbit), under Chrome & IE7, I measured
>> > > the Google hosted HelloMaps sample
>> > > (http://gwt.google.com/samples/HelloMaps-1.0.3/HelloMaps.html)  loads
>> > > in about 3 to 4 seconds after I empty the cache, and it uses a
>> > > <script> tag in the module.gwt.xml file.  Does your page load slower
>> > > on some browsers than others?  If you think download bandwidth is the
>> > > issue, another thing you could try is compressing your .cache.html
>> > > files.
>>
>> > > > The main.js gets downloaded first and then my cache html file ,can i
>> > > > reverse the order if so how ?
>>
>> > > > Please help me with this .
>>
>> > > > Thanks in advance
>>
>> > > --
>> > > Eric Z. Ayers - GWT Team - Atlanta, GA USAhttp://
>> > code.google.com/webtoolkit/
>>
>> --
>> Best Regards
>> Tóth Imre
> >
>



-- 
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to