I'm facing the following annoying problem: I created an Eclipse plugin with a dialog having a browser embedded in the form. I have to use org.eclipse.swt.browser.Browser for this purpose.
Such browser is intended to display a little page where an iframe and some javascript are used. Moreover, a link is present to open a popup with a window.open() javascript call.
On Windows everything works well, while in Mac OS X the popup doesn't appear. Why?
Thank you very much
EDIT: This is the actual code that works on Windows but not on Mac:
Browser browser = new Browser(container, SWT.NONE); browser.setBounds(10, 100, 300, 200); browser.setJavascriptEnabled(true); browser.addOpenWindowListener(new OpenWindowListener() { public void open(WindowEvent event) { new Thread( new Runnable() { public void run() { log.debug("ok is running"); //some other stuff here... } }).start(); } });
You may need to use an OpenWindowListener
on the browser. Since the browser implementation on OS X uses a different toolkit to Windows the default behavior without a listener may be different.
A simple listener would look like:
browser.addOpenWindowListener(new OpenWindowListener() { public void open(WindowEvent event) { Shell shell = new Shell(display); shell.setText("Popup Window"); shell.setLayout(new FillLayout()); event.browser = new Browser(shell, SWT.NONE); } });