|
-
September 27th, 1999, 06:15 AM
#1
Absolute and Relative Links
I have a drop down control and the items in it are links. The code I have to do this will work for absolute links like http://www.winzip.com:
String url = "http://www.winzip.com";
try { theURL = new URL(url); }
catch ( MalformedURLException e)
{
System.out.println("Bad URL: " + theURL);
}
getAppletContext().showDocument(theURL);
but it work work for relative links:
String url = "index.html";
try { theURL = new URL(url); }
catch ( MalformedURLException e)
{
System.out.println("Bad URL: " + theURL);
}
getAppletContext().showDocument(theURL);
Does anyone know why it won't work or how to get it to work?
Scott
Give a man a fish and feed him for a day,
Teach a man to fish and feed him for life.
_______________________________________________________
http://welcome.to/scottweb - The Ultimate Programmers Reference
-
January 18th, 2000, 08:57 AM
#2
Re: Absolute and Relative Links
I think this will work:
try {
URL mainURL = new URL("http://www.winzip.com");
String rel = "index.html";
URL theURL = new URL(mainURL, rel);
} catch (Exception e) {
// anything
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|