Launch URL on user's default browser

Hello,
Is it possible to launch a URL on the user's default browser, through an ActionListener? Something like:
public void actionPerformed(ActionEvent e) {
        JMenuItem source = (JMenuItem)(e.getSource());
        if(source.getText().equals("Online Help"))
          //launch URL here
}Thanx in advance! :)

Hi Derelict, check this out:
http://browserlauncher.sourceforge.net/Hope it's helpful!
Chris.

Similar Messages

  • Open tab or window in user's default browser

    hi,
    can I navigate to a url and open a new window or tab in the user's  default browser?
    In flex panels - if you'd
    navigateToURL(new URLRequest("url.com"));
    the page would open up in the user's default browser.
    How to do this in an html panel?
    When I try 
    window.open("url.com '_blank');
    a custom window opens and I'm not even sure where it comes from,
    my default  browser or the extension's embedded browser.
    Thanks!
    Jeff.

    var csInterface = new CSInterface(); 
    csInterface.openURLInDefaultBrowser('http://www.google.com');

  • Easiest way to launch a link to the default browser from java?

    Is there an easy way to launch a link in the default browser from java? Ideally I would have a graphic in a cell that when clicked on would open a new window/tab in the default browser. This would be done in SWT, but it might be similar to swing, awt, etc. Any ideas?

    If you are using Java 1.5 or earlier, I found the browser launch code found here to work fairly well: http://www.centerkey.com/java/browser

  • Invoking a url in System's default browser

    Hi All!
    I have one question related to invoking an url in a browser using Runtime.getRuntime()
    I am using the command as
    command = "rundll32 url.dll,FileProtocolHandler " + url;
    Runtime.getRuntime().exec(command);
    where url = (say) http://www.java.sun.com
    This works perfectly fine for internet and intranet and intranet.
    But if my url has spaces (more than one ) it fails.
    e.g. url = "fileserver:\\Temp 12\read.html
    Now the folder is "Temp 12" having two gaps inbetween Temp and 12.
    I tried to use exec(String [] cmdArray)
    but it gives me error as "java.io.IOException: CreateProcess: www.hotmail.com "cmd /c start" error=2"
    Where cmdArray is defined as
    String[] cmdArray =
    ("rundll32 url.dll, ileProtocolHandler " + url)
    Any suggesstion or help.
    Anand

    I ran into the same problem, and found solutions at:
    http://ostermiller.org/utils/Browser.html

  • Launch default browser to view local HTML

    I have a documentation written in HTML and I want my application to launch the user's default browser in Unix or Windows to view it.
    How can I do it ?
    Actually, I tried to show the doc in a EditorPane of my app but I only get a beep and no exception.
    Is it because the doc is long and with pictures?
    thanx!

    To my knowledge, there's no 'default browser' in Unix. You can try looking at these articles to see if they help:
    http://developer.java.sun.com/developer/qow/archive/15/index.html
    http://www.javaworld.com/javaworld/javatips/jw-javatip66.html

  • Opening webhelp in the default browser

    The sample code for calling Webhelp opens Webhelp in IE. Is
    there a way to call Webhelp from an application that opens it in
    the user's default browser, whatever that might be? Thanks in
    advance.

    Thanks for the reply. Here's what the deveoper responded:
    "We actually use the IE COM interface and feed it the URL,
    something similar to what he illustrated. Ours is like this:
    “server/path/startpage.htm#path/topic.htm” But we are
    required to launch the browser AND feed it the URL. Otherwise the
    poor user gets nothing…. "
    Is there some way to do this without launching the browser?

  • How to identify default browser through a 'C' program on solaris 8

    I have a requirement to display a html page in the default browser installed on solaris 8 machine through a C program.
    through a C program,
    1. How to identify the default browser installed on a solaris machine?
    2 How to get the path of the default browser installed on solaris machine?
    thanks in advance.

    Thaks a lot for the help,
    When Internet Explorer is installed on solaris as a default browser, it does not change
    the user-prefs.dt file. But still when a HTML document is double clicked from the file manager of solaris CDE, it opens the HTML page in Internet Explorer.
         Internet Explorer copies a file called IE.dt in /etc/dt/appconfig/types/C. Just by copying a file how does the CDE file manager is able to open any html file in Internet Explorer??
         Further the installation path of the Internet Explorer is not fixed as that of netscape. Our application need to display the HTML help in user's default browser.
    On Windows-NT this can be implemented just by passing the html file as an argument to a win32 API ShellExecute(FindExecutable can also be used.
    How this can be achieved on solaris??
    Regards,
    Atul.

  • Getting Problem Of Default Browser....

    I Am Getting Error When I Launch The Nokia Asha 200 Default Browser..... When I Click On
    INTERNET... It Will Show "Conflicting Apps?Show Items" Giving 2 Options YES R NO.....
    If U Yes It Will Show "Nokia Xpress" If U No It Will Go 2 Menu Link.... Plz Give Me Any Solution 2 Dis....
    KamIsBack

    That I Dnt Knw farby....
    C I Gone 2 Settings>Device>Devices Update>Current Sw Details
    Deatils Was
    v11.56
    26-03-12
    RM-761
    (c) Nokia...
    Wat 2 Do That I Want Nokia Browser....
    KamIsBack

  • 3.6.13 OS MAC 10.6.6 - cannot open url within Mail with Firefox as default browser

    new iMac (March '10) - no problem til last week - as above - when
    Firefox is my default browser cannot open url's form within Mail.
    OK when I change over to Safari - but going back to Firefox same issue.
    Firefox browser opens but the page does not load....
    any suggestions?

    I have the same issue. One interesting piece of info is if you quit FireFox (go to dock > right click on firefox icon > quit) Mail will then launch the link into FireFox properly. Somehow though users actions must cause it to fail again. My wife uses our iMac more than I do for email, so I haven't been able to re-create what she is doing to lose the Mail > Firefox functionality. Almost sounds like an OS X bug??

  • Error launching default browser

    I had downloaded and installed the trial versions of PSE 12 and PRE 12 in late November, 2013. Purchased both December 23, 2013 and downloaded both. Did not realize I could just enter the new product codes, and instead re-installed both. All seems to working, but when I click HELP>SUPPORT, I get error message: There was an error launching the default browser. You may need to re-install the application and the Help component. Does this refer to reinstalling PSE and PRE or the browser which is IE9? Had a chat seesion with Mohammed who told me to contact tech support who want me to pay for help. This does not seem right for a new purchase.
    Also, since the purchase occured on December 23, 2013 and today is January 3, 2014 I wonder why I am already getting emails that I have reached my limit in Revel. I thought I had thirty days for unlimited initial uploads.

    is your issue resolved now?
    ~Surendra
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • Open URL in default browser

    Hi All,
    I'm very new to this (java(fx) programming) and the last days I'm trying to figure out how I can open the default browser when the user clicks the image (loaded from webpage) in the JFXPanel. This image comes from an openx (ads) server and holds a URL as destination link.
    So far all my attempts to accomplish this have failed and I'm lost in this.
    Currently when clicking the image, the destination webpage opens in in the same JFXpanel (ofcourse), but I would like to open this in the default browser.
    this is what I currently have for initiating the scene from swing
                ap = new AdsPanel();
                ap.init();
                JPanel ad = new JPanel();
                ad.add(AdsPanel.fxContainer);the class for loading the webpage:
        //@Override
        public void init()
            fxContainer = new JFXPanel();
            fxContainer.setPreferredSize(new Dimension(JFXPANEL_WIDTH_INT, JFXPANEL_HEIGHT_INT));
            // create JavaFX scene
            Platform.runLater(new Runnable()
                @Override
                public void run()
                    createScene();
    private void createScene()
            Platform.runLater(new Runnable()
                @Override
                public void run()
                    loadURL(FixedVars.SPONSORLINK);
                    WebView view = new WebView();
                    webEngine = view.getEngine();
                    view.setContextMenuEnabled(false);
                    Scene scene = new Scene(view);
                    fxContainer.setScene(scene);
            });Hope some can help me out.
    Thank you very much in advance.

    Just found my solution!! OPening the default browser in a separate thread. Please feel free to comment me, on the code (I do not earn my money as a developer)
    private void createScene()
            Platform.runLater(new Runnable()
                @Override
                public void run()
                    loadURL(FixedVars.SPONSORLINK);
                    WebView view = new WebView();
                    webEngine = view.getEngine();
                    view.setContextMenuEnabled(false);
                    webEngine.locationProperty().addListener(new ChangeListener<String>()
                        @Override
                        public void changed(ObservableValue<? extends String> observable, final String oldValue, final String newValue)
                                if ( !newValue.contains(FixedVars.SPONSORLINK) )
                                    System.out.println("newval =: " + FixedVars.SPONSORLINK);
                                    Platform.runLater(new Runnable()
                                        @Override
                                        public void run()
                                            loadURL(oldValue);
                                    // open the destination URl in the default browser
                                    // class will open a new thread
                                    BrowserOpener.main(newValue);
                    Scene scene = new Scene(view);
                    fxContainer.setScene(scene);
        }and the class opening the default browser:
    public abstract class BrowserOpener implements Runnable {
         * url string
        private static String uriString;
        public void open(String url) throws Exception{
            URI u = new URI(url);
            java.awt.Desktop.getDesktop().browse(u);
        public void run() {
            try
                open(uriString);
            catch ( Exception ex )
                Logger.getLogger(BrowserOpener.class.getName()).log(Level.SEVERE, null, ex);
        public static void main(String args) {
            (new Thread(new BrowserOpener() {})).start();
            uriString = args;
    }

  • Launch Internet Explorer from PDF instead default browser chrome

    Hi
    I want to launch IE Browser from PDF links rather than any default browser like chrome etc.
    Is there a specific way that PDF links can be create for above requirement?
    Thanks

    Not possible. URLs are delegated to the OS which does with them what it's
    set up to do.
    The link itself (and Acrobat/Reader in general) has no way of interfering
    with that.
    On Thu, Dec 11, 2014 at 7:51 AM, sigirisetti <[email protected]>

  • I work with a web app that will not run on Firefox, so I changed my default browser back to IE but the URL link continues to open in Firefox. How can I get it to default to IE?

    After changing my default browser from Firefox back to IE, other URLs are defaulting to IE but I have one URL that continues to default to Firefox. This web app will only run in IE so the only way I can run it is to open IE first and then enter or select the URL. Is there a setting someplace that will change the default browser for this URL to be IE?

    You can make IE the default browser, that will reset some registry keys<br />
    Control Panel > Internet Options: Programs<br />
    Put a check in the box next to 'Internet Explorer should check to see whether it is the default browser'<br />
    Start IE and let IE make itself the default browser.
    Check the default settings in:<br />
    Control Panel > Add/Remove Programs > "Set Program Access And Defaults" (on the left)<br />
    Open: Custom (click arrow on the right)<br />
    Select "Internet Explorer" under "Choose a default Web Browser"<br />
    Click OK

  • How to open a URL in the default browser via CC HTML Extension?

    Hi,
    I'm trying to open a link via the default browser in a HTML Extension for Photoshop CC built with Extension Builder 3.
    With the initial example the "/indext.html" it look like this:
    <li><button class="default" id="btn_PHXS" onClick="onClickButton('PHXS')" disabled="true">Run ps code</button></li>
    and I changed the code from "/ext.js" to:
    ...function onClickButton(ppid) {    var csInterface = new CSInterface();    csInterface.openURLInDefaultBrowser('http://www.adobe.com');}...
    This is what the "/lib/CSInterface-4.0.0.js" looks like:
    * Opens a page in the default system browser.
    * @param url   The URL of the page to open. Must use HTTP or HTTPS protocol.
    * @return One of these error codes:\n
    *      <ul>\n
    *          <li>NO_ERROR - 0</li>\n
    *          <li>ERR_UNKNOWN - 1</li>\n
    *          <li>ERR_INVALID_PARAMS - 2</li>\n
    *          <li>ERR_INVALID_URL - 201</li>\n
    *      </ul>\n
    CSInterface.prototype.openURLInDefaultBrowser = function(url)
        return cep.util.openURLInDefaultBrowser(url);
    Since "util" doesn't seem to be defined  I get the message:
    Uncaught TypeError: Cannot call method 'openURLInDefaultBrowser' of undefined
    Is the something missing?
    Thx,
    frankin

    Hi Franklin,
    Apologies for the delay but I have been trying to determine why this API is not been working. I have since discovered that, although this API is documented in the JS library, the behaviour has yet to be implemented into Photoshop CC. Offline I will try to determine why this API was included in the library when it was not ready but for the meantime, if you would like to open a browser, here is a workaround:
    Instead of using:
    //(new CSInterface).openURLInDefaultBrowser("http://www.adobe.com")
    // Use the createProcess API to open a browser. The following shows a workflow in Windows to open Internet Explorer.  
    var csInterface = new CSInterface();
    var rootDir = "/";
    var isWindows = window.navigator.platform.toLowerCase().indexOf("win") > -1;
    if (isWindows) {
                        rootDir = csInterface.getSystemPath(SystemPath.COMMON_FILES).substring(0, 3);
    var processPath = "/usr/bin/open";
      if (isWindows) {
        processPath = rootDir + "Windows/explorer.exe";
    var url = "http://www.adobe.com";
    window.cep.process.createProcess(processPath, url);
    Apologies for this inconvenience but we promise to keep you informed when openURLInDefaultBrowser API is fully supported.
    Kind regards,
    Lea

  • Why do we use open URL in default browser function? What are the uses of it?

    Why do we use "open URL in default browser" function?  What are the uses of it?

    kdm7 wrote:
    Okay.
    So can we keep a web button to access the www.ni.com ? So that web site opens only when button pressed?
    P.S  I,m a newbie.
    Yes, you can also, e.g. include a help file or manual as html and open that in the browser.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

Maybe you are looking for