Opening a browser window with Java

Is there a way I can open a Browser Window (with a specific html document) from Java? Thanks.

Use Runtime.exec(cmd) with the following command:
Under Windows 9x:
   command.com /C" start "urltofile.html"Under other Windows:
   cmd.exe /C [start] "urltofile.html"  (start is needed when url begins with 'http://")

Similar Messages

  • Opening a Browser Window with no Address Bar

    Hello All,
    I am working on an application which needs to open a new browser window. I need to hide the URL from the user.
    Right now, I can open the window with no toolbar or address bar with the following command:
    String cmd = "cmd.exe /c start javascript:window.open('http://www.google.ca','main','menubar=0,location=0,toolbar=0,personalbar=0,status=0,scrollbars=1,resizable=yes')";
    However, this first opens up a blank window and then the window with no address bar. If I make the command:
    String cmd = "cmd.exe /c start javascript:window.open('http://www.google.ca','main','menubar=0,location=0,toolbar=0,personalbar=0,status=0,scrollbars=1,resizable=yes';window.close();)";
    then the user is asked if they wish to close the first blank window.
    Does anyone know how to open a new browser window via the command line without the annoying extra window?

    It works with the following command but the new browser window isn't in "focus".
    cmd.exe /c start javascript:window.open('http://www.google.ca','main','menubar=0,location=0,toolbar=0,personalbar=0,status=0,scrollbars=1,resizable=yes');window.opener=top;window.close();
    Ryan

  • Open a browser window with a different icon

    I normally have many browser windows and tabs open at the same time. My job requires quick context changes.
    I would like to open a window that has a different icon in the tool bar so I can get to that one quickly.
    Putting an icon with a preset urls works great but I would like this one session to have a unique icon that stand's by itself in the toolbar.
    I'm using Windows 7 but may need to do this with *nix systems in the future.

    HI nynjnc,
    Thank you for your question. I understand that you would like an icon in the toolbar that opens a session/window pretty quickly.
    There is an icon in the customize menu in the new Australis menu that is titled "New Window" that would open a blank window.
    However if you are looking to open a specific page try this add on: [https://addons.mozilla.org/en-US/firefox/addon/custom-buttons/?src=search Custom Buttons]
    Post back to let other users know if this worked for you!

  • Open New Browser window with "Server Behavior"

    I know how to open a link in a new browser window by going to
    the Behaviors panel. The site I'm working on is using PHP, so
    instead of a Behaviors panel all it shows is a "Server Behaviors"
    panel. Under the "Server Behaviors" there is't an option to open a
    link in a new browser window. Should I be looking someplace
    different or is there another way to add this function to a link?
    Thanks in advance for any help!

    horsethiefbasin wrote:
    > I know how to open a link in a new browser window by
    going to the Behaviors
    > panel. The site I'm working on is using PHP, so instead
    of a Behaviors panel
    > all it shows is a "Server Behaviors" panel. Under the
    "Server Behaviors" there
    > is't an option to open a link in a new browser window.
    Should I be looking
    > someplace different or is there another way to add this
    function to a link?
    >
    > Thanks in advance for any help!
    >
    Makes no difference whether youre working on a php site or an
    ordinary
    htm site you still open a new browser window in exactly the
    same way.
    windows>behaviours>open browser window

  • Opening up a new browser window in java

    So, i'm trying to open up a browser window to download the mac runtime for java, if the system is a mac. but because of microsoft not letting java to javascript communication i can't do it. anyone got any ideas?
    thanks,
    Pete

    Hi,
    you may check the platform in your applet with
    System.getProperty("os.name"); and then open new browser window with
    getAppletContext().showDocument(url_to_download, window_name);Regards,
    Martin

  • Open a browser window in the same window

    Hello everybody, I have a question:
    I want to open a browser window from an applet. Not in a new window but in the same window.
    I already know about the
    getAppletContext().showDocument(new URL("http://java.sun.com"), "_blank");
    applet-instruction but it opens the html page in a new window. I have already proved changing the "_blank" parameter for "_self" or "_parent" but stills the same: it's opened in a new window. Does anybody could help me please?
    Thanks

    public void showDocument(URL url)
    Replaces the Web page currently being viewed with the given URL. This method may be ignored by applet contexts that are not browsers.
    Parameters:
    url - an absolute URL giving the location of the document.
    Applet must be running in a browser for this to work. More information at this website
    http://java.sun.com/j2se/1.4.1/docs/api/

  • Applet launching browser window in Java 6u10+

    Finding a problem that appears to be limited to Java 6u10+. We have an applet which opens multiple JFrame windows, and in some cases, the user might click something in the applet that should trigger the browser to show a popup browser window with some web page. That part all works fine, and the browser popup shows in the front as it should in older java versions.
    However, it appears that since 6u10, now that the applet process is separate from the browser, the popup window no longer can be brought to the front of the applets. It is being launched and brought to front with Javascript, but that only brings it in front of other browser windows, no longer in front of the applet. And the only thing I can find to resolve this is to minimize/iconify the applet windows, and that's not ideal to hide all windows.
    Is there anyone else seeing this? Has anyone found any fix or work around for this (without minimizing all the applet windows)?
    thanks

    in Java 6u10 it works?
    I guess it's similar. My applet calls showDocument(), but it is only passing a URL with query string parameters which the page called reads (via Javascript) and uses JS to call window.open() with the contents based on those parameters. I don't have access to the system to change the way the web works. The team that does has looked into it, and said they do make the tofront call in JS to push the browser window up. But it won't go up all the way, only above other browser windows, and not the applet window (which is a JFrame). Then the OS (windows in this case) starts blinking the taskbar button for the popup window for attention, but that's not helpful.
    The only common factor in the reports were that it's Java 6u10 or higher. XP, Vista, FF, IE, all had the problem with 6u10+. And knowing how Sun changed the plug-in architecture, it actually makes some sense as to why this happens. However, this seems to be something that there is no way to fix short of Sun doing something. Or as mentioned, minimize my window just to let others show up, which is going to be annoying as a user to have to restore the window to go back.

  • Opening a Browser Window on event

    Upon a Hyperlink listener event I wish to open a browser window. Is there a system calll to do this? I would like to open the default browser, whether it is IE or Netscape. Any suggestions or hints?

    below works:
    import java.io.IOException;
    /** * A simple, static class to display a URL in the system browser.
    * * Under Unix, the system browser is hard-coded to be 'netscape'.
    * Netscape must be in your PATH for this to work. This has been
    * tested with the following platforms: AIX, HP-UX and Solaris. *
    * Under Windows, this will bring up the default browser under windows,
    * usually either Netscape or Microsoft IE. The default browser is * de
    termined by the OS. This has been tested under Windows 95/98/NT. * * Examp
    les: * BrowserControl.displayURL("http://www.javaworld.com") *
    BrowserControl.displayURL("file://c:\\docs\\index.html") *
    BrowserContorl.displayURL("file:///user/joe/index.html");
    * * Note - you must include the url type -- either "http://" or "file://". * */
    public class BrowserControl{
    // Used to identify the windows platform.     
    private static final String WIN_ID = "Windows";
    // The default system browser under windows.
    private static final String WIN_PATH = "rundll32";
    // The flag to display a url.     
    private static final String WIN_FLAG = "url.dll,FileProtocolHandler";
    // The default browser under unix.     
    private static final String UNIX_PATH = "netscape";     
    // The flag to display a url.     
    private static final String UNIX_FLAG = "-remote openURL";     
    *     * Display a file in the system browser. If you want to display a     
    * file, you must include the absolute path name.     
    *     * @param url the file's url (the url must start with either "http://"     
    * or     * "file://").     */     
    public static void displayURL(String url)     {     
    boolean windows = isWindowsPlatform();     
    String cmd = null;          
    try {          
    if (windows) {     
    // cmd = 'rundll32 url.dll,FileProtocolHandler http://...'
    cmd = WIN_PATH + " " + WIN_FLAG + " " + url;     
    Process p = Runtime.getRuntime().exec(cmd);     
    }               else {          
    // Under Unix, Netscape has to be running for the "-remote"     
    // command to work. So, we try sending the command and
    // check for an exit value. If the exit command is 0,
    // it worked, otherwise we need to start the browser.
    // cmd = 'netscape -remote openURL(http://www.javaworld.com)'
    cmd = UNIX_PATH + " " + UNIX_FLAG + "(" + url + ")";     
    Process p = Runtime.getRuntime().exec(cmd);     
    try {                    
    // wait for exit code -- if it's 0, command worked,          
    // otherwise we need to start the browser up.
    int exitCode = p.waitFor();               
    if (exitCode != 0) {               
    // Command failed, start up the browser     
    // cmd = 'netscape http://www.javaworld.com'     
    cmd = UNIX_PATH + " " + url;          
    p = Runtime.getRuntime().exec(cmd);     
    catch(InterruptedException x) {          
    System.err.println("Error bringing up browser, cmd='" + cmd + "'");     
    System.err.println("Caught: " + x);                    }
    }          }          catch(IOException x) {          
    // couldn't exec browser          
    System.err.println("Could not invoke browser, command=" + cmd);     
    System.err.println("Caught: " + x);          }     }
    /**     * Try to determine whether this application is running under Windows     
    * or some other platform by examing the "os.name" property.     *
    * @return true if this application is running under a Windows OS     */
    public static boolean isWindowsPlatform()     {     
    String os = System.getProperty("os.name");     
    if ( os != null && os.startsWith(WIN_ID))          
    return true;          else               
    return false;               }     
    /**     * Simple example.     */     
    public static void main(String[] args)     {
    BrowserControl.displayURL("http://www.javaworld.com");     }}

  • Openning a browser window/ send email

    Hi,
    I have a java app running as a rich client plugged into the Eclipse framework.
    I would like to be able to email the log files to a help desk. I want this to occur in two cases. 1) When a fatal error occurs (we have an exception catch block handling this), 2) If the user clicks a button to prompt it.
    If the user has an email client installed on their pc I need it open an email window with the To, Subject & Details filled in (if possible, create an attachment with the log file). - This is the same functionality as the html .
    If the user has no email client installed, then open a text file containing the log.
    What is the best way to do this. Do I use the java mail api? Any suggestions/example/links welcom.
    Thanks
    Richard
    PS> We are using SWT to develop the rich client.

    Thanks for the reply, but that's my issue. I don't want to have to know what the email client is. This because I would want to invoke this from multiple clients, and don't want to have to configure each to know the email clients settings.
    How can I open the default browser from a java app? Then I'll use the mailto cmd. Thanks

  • Open a browser window at client side

    Hi All,
    I have to open up a new browser window at the client side when a user clicks on a button.
    What are the possible ways to do this, and what is the recommended way of doing this taking into consideration the browser dependencies.
    I tried with giving a destination as http;//google.com to <af:goLink > with _blank  targetFrame.
    Can you please proved some links that can help me in doing the best possible way.
    Regards,
    ND

    Hi,
    it depends on what the use case is: Do you want to open a page of the application in a separate window or do you want to open a browser window that does not belong to the application itself ? Options you have are
    i) goLink with targetFrame = _blank (as you guessed)
    ii) issue JavaScript from Java that invokes window.open on the client (works with all browsers)
    iii) Use the dialog framework navigating with dialog:navigation-case and the command button setting to useWindow = true (Use it to open pages of the application in a dialog)
    iv) Use af:popup for dialogs that open as part of a page. (Use to show additonal information like list of values)
    Frank

  • Is it possible to open a browser window from an applet?

    Hi,
    this might seem a simple beginners question to you, but to me it is more like a nightmare.
    Is it possible to have a link in an Applet that opens up a new browser
    window with a fixed address??
    If yes, can anybody tell me how? or where can I find documentation about it?
    Please help me.
    Thanks.
    dunja

    myApplet.getAppletContext().showDocument(URL url, String target);
    TARGET:
    "_self" Show in the window and frame that contain the applet.
    "_parent" Show in the applet's parent frame. If the applet's frame has no parent frame, acts the same as "_self".
    "_top" Show in the top-level frame of the applet's window. If the applet's frame is the top-level frame, acts the same as "_self".
    "_blank" Show in a new, unnamed top-level window.
    name Show in the frame or window named name. If a target named name does not already exist, a new top-level window with the specified name is created, and the document is shown there.

  • Opening a browser window from a CHM (Win7)

    Hi All,
    I'm having a problem where a script we've had for years to open a special window (sized, no browser buttons, etc) for certain content is no longer working correctly in Windows 7.
    Here is the script:
    function OpenWindowSize(strUrl, u_width, u_height) {
    var w_width = ",width=" + u_width;
    var w_height = ",height=" + u_height;
    var strOptions = "scrollbars=yes,resizable=yes"
    strOptions += w_width;
    strOptions += w_height;
    strOptions += ";";
    var newWin = window.open(strUrl, "newWin", strOptions);
    //     newWin.document.close();
      newWin.focus();
    WinXP & Vista: a link within a CHM correctly opens a new window with only scroll bars, and resizable, with the specified dimensions (e.g. u_width=500, u_height=700)
    Win7: a link opens in a regular browser window with full menus, etc and not sized to the specified dimensions. An error also displays in the CHM file.
    CHM error message (snippet): 'newWin' is null or not an object.
    A developer managed to get the CHM error to go away by adding if (newWin != null) above the focus() line.
    He also managed to prove that the problem only exists within CHMs. When the same javascript is used in plain HTML, the window is called correctly, as per the WinXP & Vista example above.
    Does anyone know how to get my script working in Win7 so that it is sized correctly and doesn't have the menus/buttons?
    Thanks,
    Amber

    Hey All,
    I just got a message from PatricioV2, for this...I totally forgot to come back to the forum...I was so busy trying to work out the solution that now, I forget the specifics, but I did find out that there is NO WAY to customize a pop-up window from a CHM with IE 9 or 10 installed...any pop-up will have ALL the browser timings. And since I didn't want that effect, I abandoned that idea and pursued a different solution.
    However, I was able to use jQuery Colorbox...which really surprised me. But even with this, you cannot use "linked" images from the stylesheet so the controls don't show...so, you need to "style" the elements with color values (i.e. background, borders, etc.).
    Also, and very important, if your content is in an IFRAME in the CHM (which mine was), you MUST use a jQuery technique to get your colorbox to work on the PARENT window...otherwise, the colorbox effect will happen ALL INSIDE THE IFRAME...
    ...and on a side note: the code in the original post is very close to the code I was using...but all I needed to do was define the value of NULL and the script worked without any errors (which is in a post above)...but not being able to style the pop-up just ruined it for me...

  • Opening a browser window

    My issue is as follows:
    Our application consists of images and forms. We display the image in an image viewer, on left half of the screen and the form on the right half.
    When we display the image in a browser using web.show_document the image gets displayed fine but the focus remains on the newly opened browser window. The user has to click into the form to start entering information from the image into the form, losing valuable time in a high volume processing environment.
    Is there a way other than using web.show_document (foreign functions/Java/any other technology) that will allow me to open a browser window from the form and then send the control back to the form?
    Thanks
    SP

    Hi,
    check this one
    WEB.SHOW_DOCUMENT
    Frank

  • New Window Opening Behind Browser Window

    I have produced a page in DW3 for an artist where you click
    on a thumbnail and it opens a new window with an enlargement of
    that image. (I use the DW3 javascript behaviour to do this).
    When I test it on my browsers the windows open in front of
    the main browser window and all is hunky dory.
    When my client does the same, she claims that some of the
    windows open in front of the main browser window but some open
    behind the browser window and are obscured. She says she perceives
    a "flash" if the new window opens behind the browser window. She is
    using Firefox 2.0.9.17
    Has anyone experienced this behaviour and figured out a
    fix?

    .oO(spiro_t)
    >I have produced a page in DW3 for an artist where you
    click on a thumbnail and
    >it opens a new window with an enlargement of that image.
    (I use the DW3
    >javascript behaviour to do this).
    >
    > When I test it on my browsers the windows open in front
    of the main browser
    >window and all is hunky dory.
    >
    > When my client does the same, she claims that some of
    the windows open in
    >front of the main browser window but some open behind the
    browser window and
    >are obscured. She says she perceives a "flash" if the new
    window opens behind
    >the browser window. She is using Firefox 2.0.9.17
    >
    > Has anyone experienced this behaviour and figured out a
    fix?
    Usually the user/browser decides where new windows/tabs will
    be opened.
    But why open a new window at all? Why not use something like
    Litebox?
    Micha

  • Opening new browser window

    Hi,
    this piece of code use to work for opening a new browser, but now it has problem in opening browser window. There is no exception thrown, can anyone has suggestion whats wrong in this. I am using JRE1.3. I have a feeling that something is conflicting with IE (I tried on 5.0,5.5,6.0)
    thanks
    Syed
    try
    URL url = new URL(urlString);
    applet.getAppletContext().showDocument(url, "_blank");
    } // End of Try
    catch(MalformedURLException e)
    logs("Exception in opening new browser window: " + e);
    } // End of Catch

    Same here.
    Worked fine under IE5.x to IE6, JRE 1.3.x to 1.4. OS used were W2k and WinXP, no prob here.
    Now on some PCs the windows don't pop up anymore. No exception, no indicator of what's going wrong.
    Any hints?
    J�rgen

Maybe you are looking for

  • GRC AC 10.0 - BRM - Methodology is not working

    Hi Gurus! I'm having an issue with BRM component. I've configured all steps necessary for role maintenance, as it's indicated in document "AC 10.0 - Business Role Management". I'll be creating derived roles, composite roles, simgle roles and profiles

  • File Adapter Write Compilation problem JDev 11.1.1.6 and BPEL 2.0

    Hi, Im creating a simple BPEL Project with a One-way Process template project. I have added just one Partnerlink with a File Adapter to do a write operation. I have assigned the main process input to the file Write Invoke operation. But I am getting

  • Proforma Invoice and shipment

    Hi, Can we create Proforma Invoice when the shipment status is Trp Planning completed. We are not able to create proforma Invoice and the error we are getting when we tried to create Proforma invoice is " statistical Line item not relevant for billin

  • E-Recruiting-  Creating Infoset

    Hi I want to create a infoset to capture candidate data. I have given the following parameters to create an infoset. Logical database: PCH Package: ZHRRCF When I click on check icon system is displaying the message ‘Error in parameter PCHINDEX’ What

  • Start and End dates for users in Enterprise portal

    Hi Expert, I have to maintain start and end dates for around 200 users in 4 different Java systems. When I export the file of users it does not capture the validity fields. Is there a way/script to automate this? Otherwise I will have to do it manual