SWT浏览器未使用D3显示页面

问题描述

我想显示一个在SWT浏览器中使用D3的html页面。

如果我加载www.google.com之类的URL,它将正确加载并允许我进行搜索。如果我尝试加载包含D3的页面,我发现什么也不会显示,也不会输出错误。

示例

public class D3BrowserExample {

    public static void main(String args[]) {
    Display display = new Display();
    final Shell shell = new Shell(display,SWT.SHELL_TRIM);
    shell.setLayout(new FillLayout());
    Browser browser = new Browser(shell,SWT.NONE);
    browser.addTitleListener(new TitleListener() {
        @Override
        public void changed(TitleEvent event) {
        shell.setText(event.title);
        }
    });
    browser.setBounds(0,1200,900);
    shell.pack();
    shell.open();

    browser.setJavascriptEnabled(true);

    browser.setUrl("https://observablehq.com/@d3/force-directed-graph");

    browser.addProgressListener(new ProgressListener() {
        @Override
        public void completed(ProgressEvent event) {
        System.out.println("Page loaded");

        }

        @Override
        public void changed(ProgressEvent event) {
        }
    });
    
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
        display.sleep();
        }
    }
    }
}

是否可以使用SWT浏览器执行D3?另外,如何获取Javascript输出来调试问题?

更新

我已经在另一台SWT版本为4.3的Windows 10 PC上进行了尝试。进度监听器将调用complete方法,但不会显示任何内容。

Eclipse Bugzilla

https://bugs.eclipse.org/bugs/show_bug.cgi?id=568789

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...