如何将id = someScript和param1 = value1传递给GWT ScriptInjector?即,JS:
<script src="https://blah.com/someScript.js" id="someScript" param1="value1"></script>
可以像这样加载:
ScriptInjector.fromUrl("https://blah.com/someScript.js").setCallback(new Callback<Void, Exception>() {
public void onSuccess(Void result) {
}
public void onFailure(Exception reason) {
}
}).inject();
但是,我在哪里可以传入id =“someScript”和param1 =“value1”?
答案 0 :(得分:0)
通过URL传递参数,就像通常在URL中传递参数一样。
ScriptInjector.fromUrl("https://blah.com/someScript.js?param1="+value1).setCallback(new Callback<Void, Exception>() {
public void onSuccess(Void result) {
}
public void onFailure(Exception reason) {
}
}).inject();