Results 1 to 5 of 5
  1. #1
    plot is offline Member
    Join Date
    Dec 2013
    Posts
    12
    Rep Power
    0

    Default How to load a site or URL?

    So the user is on a website and I want them to go to another site using the same browser and tab.

    Can this be done in java? And yes the java program is running on the browser if that helps.

    Thank you

  2. #2
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    985
    Rep Power
    2

    Default Re: How to load a site or URL?

    Assuming you're talking about an applet:
    Java Code:
    URL myURL = "http://.....";
    myApplet.getAppletContext().showDocument(myURL);
    @see http://docs.oracle.com/javase/7/docs...etContext.html
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    plot is offline Member
    Join Date
    Dec 2013
    Posts
    12
    Rep Power
    0

    Default Re: How to load a site or URL?

    Quote Originally Posted by SurfMan View Post
    Assuming you're talking about an applet:
    Java Code:
    URL myURL = "http://.....";
    myApplet.getAppletContext().showDocument(myURL);
    @see AppletContext (Java Platform SE 7 )
    Is this running a file on that site? My site is set up I just need to go to another site when the user clicks a button. I was able to do it with html but I would rather perfer it to work in my Pannel

  4. #4
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    985
    Rep Power
    2

    Default Re: How to load a site or URL?

    Quote Originally Posted by plot View Post
    Is this running a file on that site?
    Eh? You make no sense. Nothing is "running a file on a site", whatever that may imply. If you have an applet in your html-page, which is still an assumption you didn't clarify, then this code will make your applet tell the browser to navigate to a different URL.

    Please make your question a bit clearer. For example, what is a "Pannel", and who made that? Is that a JPanel? Is is something else? Are you really running an Applet? Or have to mistaken Java for Javascript?
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  5. #5
    plot is offline Member
    Join Date
    Dec 2013
    Posts
    12
    Rep Power
    0

    Default Re: How to load a site or URL?

    Quote Originally Posted by SurfMan View Post
    Eh? You make no sense. Nothing is "running a file on a site", whatever that may imply. If you have an applet in your html-page, which is still an assumption you didn't clarify, then this code will make your applet tell the browser to navigate to a different URL.
    Mine is running an JApplet and in that JApplet its a JPanel. The code you gave me does not work with JPanel, I did this to solve the problem:

    Java Code:
    String myURL = "http://google.com";
                    try
    		{ 
    			Desktop.getDesktop().browse(URI.create(myURL));
    		} 
    		catch(IOException e1) {
                            System.out.println(e1);
                   }
    So far I dont have any issues with this

Similar Threads

  1. I don't think this site is for me?
    By Lulumags53 in forum Introductions
    Replies: 1
    Last Post: 01-16-2013, 08:29 PM
  2. could not load load from location:/test_subreport.jasper
    By jadeite100 in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 03-27-2012, 11:43 AM
  3. My new site
    By sijitg in forum Reviews / Advertising
    Replies: 0
    Last Post: 10-05-2010, 09:59 AM
  4. Im a new member of this site
    By orthoritz in forum Introductions
    Replies: 4
    Last Post: 06-08-2010, 04:55 PM
  5. Site hacked
    By tim in forum Suggestions & Feedback
    Replies: 3
    Last Post: 02-02-2008, 09:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •