Thursday, June 24, 2010

Flash of Unstyled Content

I'm trying to introduce GWT into an existing page, both to get rid of
my Javascript headaches, and to take advantage of ClientBundle. I'm
using:

...
private static final MyClientBundle myBundle =
GWT.create( MyBundle.class );

public void onModuleLoad() {
StyleInjector.injectAtStart( myBundle.style().getText(), true );
...
}
...

...and everything shows up as expected, but on the compiled-down code
there's a brief flash of unstyled content (FOUC) before the bundle
kicks in. It's the same problem on IE, FF, Safari & Chrome.

I can see why it's happening - onModuleLoad won't get called until the
browser calls onLoad, and by then it's already rendered the page - but
I'd like to fix it if I can. (I suppose I can hide the page as it
loads and use GWT to make it visible, but that feels a bit hackish.)
Does anyone have a proper way to fix this?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment