我想开始" Chrome.exe"通过javaScript使用ActiveXObject,但它在Vaadin中不起作用。 有人有想法吗?谢谢!
button.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
try {
UI.getCurrent().getPage().getJavaScript().execute(getScript());
} catch (Exception e) {
e.printStackTrace();
}
}
});
public String getScript() {
StringBuilder array = new StringBuilder();
array.append("try {");
array.append("var wsh = new ActiveXObject(\"WScript.shell\");");
array.append("alert('test');");
array.append("var reg = wsh.RegRead('HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe\\');");
// array.append("alert(reg);");
array.append("wsh.Run(reg+'http://stackoverflow.com'); ");
array.append(" wsh=null;");
array.append("} catch (e) {");
array.append("alert(e);");
array.append("return false;");
array.append("}");
// array.append("}");
// array.append("}");
return array.toString();
}