new bootstrap mechanism - .nocache.js

11 views
Skip to first unread message

Mark Volkmann

unread,
Sep 2, 2007, 8:41:00 PM9/2/07
to Google-We...@googlegroups.com
The 1.4 application creator script creates an HTML file that contains a script tag for {module-name}.nocache.js inside the head tag. However, all the documentation I've seen on this says it should go inside the body tag. For example, see
http://code.google.com/support/bin/answer.py?answer=75278&topic=12430

Which is correct? Well, I know it works when it is inside the head tag, so maybe either way is okay.

---
Mark Volkmann


krispy

unread,
Sep 4, 2007, 10:16:23 AM9/4/07
to Google Web Toolkit
I put mine in the <body> for no reason other than other <script> tags
that you need in the <head> (like the Google Maps API <script>) must
be placed before the GWT script - by putting it in the <body>, there's
no chance of weird errors happening when you put the <script>s in the
incorrect order. I've seen people do both and say it works fine, but
I don't know enough about JS and how browsers load libraries to know
what the difference would be.

-krispy

On Sep 2, 8:41 pm, Mark Volkmann <m...@ociweb.com> wrote:
> The 1.4 application creator script creates an HTML file that contains
> a script tag for {module-name}.nocache.js inside the head tag.
> However, all the documentation I've seen on this says it should go

> inside the body tag. For example, seehttp://code.google.com/support/bin/answer.py?answer=75278&topic=12430

Max

unread,
Sep 4, 2007, 12:32:06 PM9/4/07
to Google Web Toolkit
Hej Mark,

On 3 Sep., 02:41, Mark Volkmann <m...@ociweb.com> wrote:
> The 1.4 application creator script creates an HTML file that contains
> a script tag for {module-name}.nocache.js inside the head tag.
> However, all the documentation I've seen on this says it should go

> inside the body tag. For example, seehttp://code.google.com/support/bin/answer.py?answer=75278&topic=12430


>
> Which is correct? Well, I know it works when it is inside the head
> tag, so maybe either way is okay.

as krispy said, it doesn't really matter. But take a look at that:
http://developer.yahoo.com/performance/rules.html#js_bottom

Yahoo suggests putting JavaScript as low as possible inside your HTML
page for performance reasons. Interesting point.

Cheers!
Max

Sumit Chandel

unread,
Sep 4, 2007, 6:06:58 PM9/4/07
to Google-We...@googlegroups.com
Hi Mark,

As Max and krispy mentioned, your GWT application should load whether the script tag is in the head or in the body.

However, Max raises an interesting point in that having the script tag as low as possible in your HTML page leads to better performance in application loading. In fact, this is the reason why the FAQ you referenced above suggested adding the script tag to your <module>.nocache.js in the body. That said, the 1.4 applicationCreator script should also include the script tag in the body to improve performance.

I've create a new report (issue #1600) for this on the Issue Tracker to have it fixed for 1.5:
http://code.google.com/p/google-web-toolkit/issues/detail?id=1600

It's also worth mentioning that if your static HTML doesn't render anything before calling into GWT, the section you choose to include the script tag won't affect load time performance.

Thanks,
-Sumit Chandel
Reply all
Reply to author
Forward
0 new messages