Tuesday, August 10, 2010

Re: cross-domain with GWT (load JavaScript)

The SOP doesn't apply to script tags. This is the idea behind JSONP.
Speaking of which, this code is from the JsonpRequest class:

ScriptElement script = Document.get().createScriptElement();
script.setType("text/javascript");
script.setSrc(uri.toString());
Document.get().getElementsByTagName("head").getItem(0).appendChild(script);

On Aug 10, 7:23 am, Vincent COROLLEUR <vcoroll...@gmail.com> wrote:
> Hello,
>
> I'm trying to load dynamically a script from another domain.
> I think it doesn't work because of the cross-domain protection.
>
> I'd like to do something like that :
>
> Element script1 = DOM.createElement("script");
> script1.setAttribute("type", "text/javascript");
> script1.setAttribute("src", crossdomainURL);
> RootPanel.getBodyElement().appendChild(script1);
>
> Any ideas ?
>
> Regards,
>
> Vincent COROLLEUR

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate