On 29 août, 07:02, daysleeper <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> How can I make my GWT code (i.e. the .js files) load/execute before
> the other body elements in the browser? Please see the example below:
>
>   <body>
>      <script type="text/javascript" language="javascript"
> src="com.google.gwt.sample.hello.Hello.nocache.js"></script>
>     <script> alert("alert2");</script>
>  </body>
>
> Furthermore, in my Hello.java file, I have an Window.alert("alert1")
> call in the onModuleLoad() function. I would expect alert1 to display
> before alert2, since html loading happens sequentially. But, that does
> not seem to be the case with gwt. Could that be because GWT seperates
> the .js code into "cache" and "nocache" components? I am just
> confused!!

I've answered a similar question in the past 2 weeks; have a look in
the archives.

Basically, that's how the "selection scripts" are written (by the
linkers: commonly std or xs): they wait for the body to have been
fully loaded (DOMContentLoad event or equivalent). Moreover, using the
std linker (the default one) adds a small additional delay because the
application's code is loaded within an IFrame, that makes it totally
"asynchronous".

If you really *need* such "synchronous" loading (beware that you won't
be able to use RootPanel.get(...) on elements following the script,
and that appending to the body element --RootPanel.get(), without
argument-- will cause IE to blow away), you'd have to adapt the "xs"
linker (class XSLinker) and it's selection script (XSTemplate.js).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to