Friday, April 19, 2013

Re: Adding DOM script throws JavaScriptException in IE

I believe "DOM.setInnerText(script, builder.toString());" throws Exception. You can try to find which command throws it with (try-catch), and try to find workaround. If setInnerText throws error, try with setInnerHtml.

On Friday, 12 April 2013 18:24:10 UTC+2, nestorjb wrote:
Hi

I'm using GWT and adding some dynamic javascript using the following code:

        script = DOM.createElement("script");
        script.setId("validation");
        builder.append("function validate(validationId) {\n");
        ...
        builder.append("}\n");
        DOM.setElementAttribute(script, "type", "text/javascript");
        DOM.setInnerText(script, builder.toString());
        DOM.appendChild(RootPanel.getBodyElement(), script);

In firefox works OK but in IE it throws JavaScript: Unknown Error.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment