In my html page there are external images and flashes, sometime they load slowly. My gwt app always starts running after they are loaded. I use xsiframe linker.
Is there any way to start running gwt before loading any images and resources which are inside body? Or make sure loading other things will not block starting gwt.
EDIT: I have created a minimal project that reproduces the problem:
entry point:
public class MyEntryPoint implements EntryPoint {
public void onModuleLoad() {
Window.confirm("onModuleLoad");
}
}
html page:
<html><head>
<script type="text/javascript"src="nocache.js"></script>
</head><body>
<!-- http://stackoverflow.com/questions/100841/artificially-create-a-connection-timeout-error -->
<img src="http://10.255.255.1/timeout.gif" alt="timeout image" />
</body></html>
There are two possible solutions I can think of:
1. xs linker
You could use the old “xs” linker instead of “xsiframe”. This is not so nice, especially because xs doesn’t work in dev mode. But maybe you could use xsiframe during development, and then switch to xs for the real builds, tests and production.
2. the
<noscript>tag trickYou can put the page contents, especially the slowly loading images, into a
<noscript>tag, which is used, if the browser doesn’t support JavaScript.If however JavaScript is enabled, then the contents of that tag are ignored during loading. So what we will do in our GWT code (which can use the xsiframe linker again), is to copy the contents of the noscript tag back into the real page.
Here’s some quick code: