use of com.teamdev.jxbrowser.chromium.DownloadItem in project TeachingInSimulation by ScOrPiOzzy.
the class TestJxBrowserPdf method start.
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.initStyle(StageStyle.TRANSPARENT);
Browser browser = new Browser(BrowserType.LIGHTWEIGHT);
BrowserView view = new BrowserView(browser);
primaryStage.setScene(new Scene(view));
browser.loadURL("http://192.168.1.19:8082/Test/Fanuc0i参数说明书.pdf");
// browser.executeJavaScript("var child=document.getElementById(\\\"download\\\");child.parentNode.removeChild(child);");
// browser.executeJavaScript("alert(document.getElementById('download'))");
browser.setDownloadHandler(new DownloadHandler() {
@Override
public boolean allowDownload(DownloadItem download) {
System.out.println(download.getURL());
return false;
}
});
primaryStage.show();
}
Aggregations