2
votes

I have following requirements. I am using Notes 853/ IBM 9.

  1. Open External link using System default browser when click anchor tag from xpinc

  2. Currently its open external url also with XUL runner even though i have set the following properties.

File -> Preference - > Web browser -> Use the browser I have set as the default for the operating system.

Please advice if have any work around for this issue.

Along with i have one more issue. If external link is https, then xpinc not allow to open in new tab. I mean taget = "_blank" is not works. It only work with "self"

2
You could use: facesContext.getExternalContext().getRequest().getHeader("User-Agent"); to determine the OS as a workaround. - Michael Saiz
Even find the OS, how can i open External link with system default browser from xpinc. Ex. The URL is wwww.google.com. I like to open in external browser when click instead of open in xpinc itself. is it doable? - Mahendran Rathinam

2 Answers

0
votes

Most likely you won't like the answer you are about to read:

XPiNC runs inside a browser (the embedded XULRunner a.k.a Firefox, the elder). So you could rephrase the question: How do I open a link in one browser from another browser (e.g. Open a link in Chrome from Firefox or from Opera in IE)?

The answer is: you can't (at least for the moment)

0
votes

I had the same question, and I found the answer at this site: https://caysal.wordpress.com/2016/04/22/xpinc-open-url-link-in-os-default-browser/

In case this site goes down, the solution (provided by Chris Toohey) was the create a Java Bean which reads thus:

package com.dominoguru.xulHack;
public class xulPunter {
    public static void punt(String url) {
        try {
            Runtime rt = Runtime.getRuntime();
            Process proc = rt.exec("rundll32 url.dll,FileProtocolHandler " + url);
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }       
}

and then to call this within your SSJS as:

<xp:this.action>
  <![CDATA[#{javascript:
  importPackage(com.dominoguru.xulHack);
  xulPunter.punt("http://www.google.com");}]]>
</xp:this.action>

Although this question is almost 5 years old, I had a similar issue and hope this will help anyone who has the same issue in the future.