Loading GWT module after page is loaded

418 views
Skip to first unread message

szebeni

unread,
Sep 29, 2010, 11:54:35 AM9/29/10
to Google Web Toolkit
Hy peps,
I have a GWT App which is loading perfectly on a host page, but I
need to do some interaction before Its loaded, which cause this issue:
I get only a loading blank screen if I'm writing the script tag for
nocache.js into the document after the page loaded. Do you know why is
it and how can I fix it?
I checked and the path is fine, just the generated js code behaves
differently (like the function from nocache.js is undefined in the
browser specific one).

szebeni

unread,
Sep 30, 2010, 4:00:33 AM9/30/10
to Google Web Toolkit
please propose a solution

szebeni

unread,
Sep 30, 2010, 4:00:38 AM9/30/10
to Google Web Toolkit
please propose a solution

On Sep 29, 5:54 pm, szebeni <kha...@gmail.com> wrote:

Denis Vilyuzhanin

unread,
Sep 30, 2010, 5:28:53 AM9/30/10
to Google Web Toolkit
I know that GWT has problem with dynamic loading after page already
loaded. Because default linker uses document.write() expression during
bootstrap. document.write() method replace all content of page and you
get empty page.

if you open you *.nocache.js which was compiled with -style DETAILED
parameters you will see this in computeScriptBase() function and the
last line.
and actually one solution I know is using custom GWT linker.

lineman78

unread,
Sep 30, 2010, 1:02:56 PM9/30/10
to Google Web Toolkit
That is correct, you will end up with a blank page if you try to use
the default iFrame linker and load modules dynamically. This used to
not be the case, but is now. You could probably go back to GWT 1.5 or
1.6 and grab it's iFrame linker and use it.

szebeni

unread,
Oct 1, 2010, 1:14:32 AM10/1/10
to Google Web Toolkit
Thanks for help, I think I will try to use a custom linker this way.

Aladdin

unread,
Mar 10, 2013, 10:38:49 AM3/10/13
to google-we...@googlegroups.com
I'm not sure if I understand your problem, but we got away with it and were able to load the module dynamically. We need it that because we want to get the locale from parameter or the local storage (HTML5). We also don't trust the proxy caching so we added random number with the request. 

<head>
<script type="text/javascript">
//l=the locale from param or local storage

$('head').append('<meta name="gwt:property" content="locale='+l+'">');

var r=Math.random();
var p="MODULE_NAME.js?x="+ r;
var xx='<script type="text/javascript" src="'+p+'" ></'+'script>';
document.write(xx);
</script>
</head>

Alaa
Reply all
Reply to author
Forward
0 new messages