Results 1 to 5 of 5
  1. #1
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default Applet - get current URL

    I want to have an applet which you can show the url of the current page.
    I don't know how I can get the url of the current page.

    Does someone know it?

    Thanks,
    Dennis

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,307
    Rep Power
    25

    Default

    There are some methods in the Applet class that return URLs. Have you looked at them?

  3. #3
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    You can get
    this.getCodeBase()
    with your applet. Also you can use JavaScript with your applet to get this effect
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  4. #4
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    Oh, I thought the method "this.getCodeBase()" return the location of the .class file. :P

    Thanks!

    [SOLVED]

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,307
    Rep Power
    25

    Default

    When in doubt use println() to show what's happening:
    System.out.println("codeBase=" + this.getCodeBase());

    Then you'll know

Similar Threads

  1. changing current directory
    By flaca in forum New To Java
    Replies: 7
    Last Post: 03-06-2011, 02:50 AM
  2. Get dates of current week
    By Qlubbie in forum New To Java
    Replies: 2
    Last Post: 11-19-2008, 09:03 AM
  3. Current month
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-07-2008, 08:40 AM
  4. Getting current userís name
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-07-2007, 12:04 PM
  5. How can i get current directory?
    By Ashley in forum New To Java
    Replies: 1
    Last Post: 05-26-2007, 01:21 PM

Posting Permissions

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