Thursday, June 5, 2014

Howto use Xulrunner instead of Internet explorer as browser component in a Notes RCP

One of the coolest features in Notes RCP applications is, that you can embed a browser widget in your application. You can use the browser widget as a document viewer, to view an interactive map for example with openlayer, or to visualize your data as a chart with dojo chart running inside the browser widget.




The browser widget in a Notes RCP application uses the built in browser of your operating system. For example on Windows this is always the internet explorer no matter what browser you have chosen as default in windows or Notes. IE has some serious disadvantages compared to other rendering engines:
  • IE is very slow when you are using Openlayer maps with many features.
  • Maybe your application will break if IE is updated by an automatic software update from MS.
  • IE can not render .BMP files.
  • IE does not support web standards.
Fortunately there is a XULRunner (rendering engine from Mozilla Firefox) built into Notes and with some tricks you can create a XULRunnner browser widget instead of the IE one. Here is the code with a fallback to IE if something went wrong.

 
    //Get built in XULRunner of Notes for Windows
  Bundle bundle = Platform.getBundle("com.ibm.rcp.xulrunner.runtime.win32.x86"); 
  boolean xulRunnerAvailable = false;
  if (bundle != null) {
   URL resourceUrl = bundle.getResource("xulrunner"); 
   if (resourceUrl != null) {
    try {
     URL fileUrl = FileLocator.toFileURL(resourceUrl);
     File file = new File(fileUrl.getFile().substring(1));
     //Set the XULRunnerPath to the built in runtime.
     System.setProperty("org.eclipse.swt.browser.XULRunnerPath", file.getAbsolutePath()); 
     xulRunnerAvailable = true;
    } catch (IOException e) {
     e.printStackTrace();
    }
   }
  }
  //If XulRunner is available get an Instance of Mozilla or if not fallback to IE.
  if (xulRunnerAvailable)
   browser = new Browser(parentComposite, SWT.MOZILLA);
  else
   browser = new Browser(parentComposite, SWT.NONE);


The only drawback of the Xulrunner of Notes is, that it is a little bit dated. So i really hope that IBM will update the instance of XULRunner in future service packs of the Notes client. This is especially important because this Xulrunner runs xPages in the Notes client too.

3 comments:

  1. Hello guys! Great solution with downloading best browsers and latest updates is available now. Using the Safari Download https://yepdownload.com/safari you may see the quality and speed of instlation. Because on official website some times exist a bit problems with updating and installing the app's. Based on my experience, it is easy to do this way. And thank you in advance, for such instructions. I will keep this for the future.

    ReplyDelete
  2. Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include.
    Shortener

    ReplyDelete
  3. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.
    speed test charter

    ReplyDelete

ad