|
GWT 2.4.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.core.client.ScriptInjector.FromUrl
public static class ScriptInjector.FromUrl
Build an injection call for adding a script by URL.
Method Summary | |
---|---|
JavaScriptObject |
inject()
Injects an external JavaScript reference into the document and optionally calls a callback when it finishes loading. |
ScriptInjector.FromUrl |
setCallback(Callback<java.lang.Void,java.lang.Exception> callback)
Specify a callback to be invoked when the script is loaded or loading encounters an error. |
ScriptInjector.FromUrl |
setWindow(JavaScriptObject window)
This call allows you to specify which DOM window object to install the script tag in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public JavaScriptObject inject()
public ScriptInjector.FromUrl setCallback(Callback<java.lang.Void,java.lang.Exception> callback)
Warning: This class does not control whether or not a URL has already been injected into the document. The client of this class has the responsibility of keeping score of the injected JavaScript files.
Known bugs: This class uses the script tag's onerror()
callback to attempt to invoke onFailure() if the
browser detects a load failure. This is not reliable on all browsers
(Doesn't work on IE or Safari 3 or less).
On Safari version 3 and prior, the onSuccess() callback may be invoked even when the load of a page fails.
To support failure notification on IE and older browsers, you should check some side effect of the script (such as a defined function) to see if loading the script worked and include timeout logic.
callback
- callback that gets invoked asynchronously.public ScriptInjector.FromUrl setWindow(JavaScriptObject window)
builder.setWindow(ScriptInjector.TOP_WINDOW);
window
- Specifies which window to install in.
|
GWT 2.4.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |