Posts Tagged java swt browser xulrunner

Mozilla’s xulrunner and the browser composite of SWT

If you work with the browser composite of SWT you may have the problem that you cannot know which underlying browser is used for rendering. But that’s important if you don’t want to run in well known browser bugs.
To avoid this you can use the XULRUNNER, the underlying rendering engine for Firefox 3.x. You can get it for OS X, Linux and Windows.

Browser getBrowser(Composite parent, File xulDir) {
  if (xulDir != null && xulDir.exists())
    System.setProperty("org.eclipse.swt.browser.XULRunnerPath", xulDir.getAbsolutePath());
  return new Browser(parent, SWT.MOZILLA);

This factory method sets the required system property if the directory of the XULRUNNER is known. This could be, if the XULRUNNER is bundled with your application. Otherwise the common lookup mechanism is used.

Leave a comment