Finally, there is a solution!

The solution I propose here to generate the script tag (that permits
to inject the GWT module) is to use the document.write JavaScript
statement.
In the example bellow, the generation of the script tag depends of
some condition

<script language="javascript">
    if (!isomorphicDir) {
        ...
        document.write('<script type="text/javascript"
language="javascript" src=".../.../
com.lsy.clink.reports.Main.nocache.js"><\/script>');
    }
</script>

An important point to note is on the closing script tag: the /
character is escaped: \/.

In my application, a JSP generates this part for a GWT portlet.

I tried others solutions like add a script tag element using DOM on
the body element, but without success.


Hope this help!

Bertrand.


On 5 oct, 16:07, bgoetzmann <[email protected]> wrote:
> Is someone have some idea to do that?
>
> Bertrand ;-)
>
> On 24 sep, 21:29, Raziel <[email protected]> wrote:
>
>
>
> > I have a similar problem. I need to be able to load my entry point
> > class without using a script tag.
>
> > The .nocache.js script depend on being loaded through the tag since it
> > uses the src attribute to find the location of the other .js files.
>
> > I thought doing something like what you did here (creating a new
> > script tag and adding it directly to the DOM) would be enough.
> > However, the document.write either doesn;t work, or the logic to place
> > a marker tag and get a sibling script to obtain the src doesn't always
> > get the right tag (it gets other tags that I'm including in my page).
>
> > So basically I'd like to know the same thing: how can I load
> > the .nocache.js script without using a hardcoded script tag.
>
> > On Sep 23, 10:51 am, bgoetzmann <[email protected]> wrote:
>
> > > Thank you Thomas,
>
> > > I searched on the GWT source code, and learnt several things on
> > > linkers. For the moment, what can interest me is how I could modify
> > > the ...Main.nocache.js file. I thought find a template...
> > > Any idea about this?
>
> > > - Bertrand.
>
> > > On 19 sep, 00:53, Thomas Broyer <[email protected]> wrote:
>
> > > > On 17 sep, 18:32, bgoetzmann <[email protected]> wrote:
>
> > > > > Hello,
>
> > > > > I'm developing a GWT 1.6 application with SmartGWT; the application
> > > > > works well! The web page's body I use has of course the code bellow to
> > > > > load the application:
>
> > > > > <script language="javascript" src="/...Main.nocache.js"></script>
>
> > > > > I search a way to dynamically load the application but without
> > > > > success; for example, on a link with code like this, in order to add a
> > > > > script tag to the page's document:
>
> > > > > <a href="javascript:f()">test</a>
>
> > > > > Having f defined like this:
> > > > > function f() {
> > > > >             var script = document.createElement('script');
> > > > >             script.setAttribute('type', 'text/javascript');
> > > > >             script.setAttribute('src', '/...Main.nocache.js');
> > > > >             document.getElementsByTagName('body')[0].appendChild
> > > > > (script);
>
> > > > > }
>
> > > > > But it soesn't work;the behavior is even strange because the entire
> > > > > page content is replaced by the tag html containg a sery of script
> > > > > tags.
>
> > > > That's because the selection scripts (nocache.js) use document.write()
>
> > > > > How can I achieve a dynamic load?
>
> > > > You'd have to write your own selection script. Search the group
> > > > archives and look at Linkers.
--~--~---------~--~----~------------~-------~--~----~
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