What does this method do.
Main Topics
Browse All TopicsI need to be able to do the following. I have a popup window that contains me Applet. Then when a person clicks a button (or link or something on the applet) it then needs to go and gather the URL in the original browser window that opened the applet. In actuality I would like to get the URLs from all browser windows except of course the one that the applet is in. Is there any way of doing this.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
in this case, you can pass the real url to the applet in two ways :
1. as an applet paramter :
this is pretty hard without asp crap, so I wouldnt go for that.
2. as a part of the url of the frame you opened :
when you open the page with the applet, give it an url argument, like
www.host.com/yourpage.html
then, using getDocumentBase, you will be able to easly extract the thing after the '?', and thats what you need.
It's not frames based, the applet lives in a new window. But the problem is that if the person changes the URL in the parent window I need to be able to grab the current URL of the parent window.
Think of a bookmark type application. Where a person clicks on a link a new window appears containing my applet. Then what happens is at a later date in the applet they will click a button and the applet then gets URL from the parent window (not the one with applet on it).
omry's right....there really is no way to get the URL with Java by itself, but it's easy to use javascript with it. You are allowed to call applet functions in Javascript by referring to appletName.function where appletname is the name you give the applet in the applet tag. so, you could do something like this:
java:
public URL getURL(String s) {
URL url;
try {
url = new URL(s);
} catch (MalformedURLException mfe) {}
return url;
}
and then in Javascript/html you could do something like this:
<applet code="theapplet.class" name="anapplet"></applet>
<input type="button" onClick="javascript:anappl
this is just an example I'm not sure exactly what you need, all that does is pass the URL of the browser to the applet when someone clicks a button.
I don't think you can achieve this directly using Java.
It may be possible for the applet to retrieve the required information using a javascript call.
Though not sure if js can do it or not.
Best bet would be to ask question in the javascript topic to see if javascript can get the url loaded in other windows.
http://www.experts-exchang
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- To be PAQ'ed and points refunded
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
Exceter
Cleanup Volunteer
objects & omry_y- What do you suggest should be done?
I'm refunding at least half of the points due to the nature of the answer (pretty much comes down "no"). Would a split, 25 points to each, be acceptable? (A grades will be given on the splits)
If not, you have a single comment each to make a suggestion. This has been open for too long already.
Banath
EE Moderator
The question is "Is there any way of doing this".
the answer is no, not using java alone.
This is a valid answer.
if you insist about refunding half, than you can do as you please with the other half (I don't mind).
now that I think about it, there is another way.
it involves putting a small applet in each Frame the user opens, which will look like this:
class SpyApplet extends Applet
{
private static Hashtable s_map = new Hashtable();
public void init()
{
s_map.put(getDocumentBase(
}
public void destroy()
{
s_map.remove(getDocumentBa
}
public static String[] getDocBases()
{
String res[] = new String[s_map.size];
// junior hacker task : fill up the array
return res;
}
}
Of course, this solution have requirments which are hard to fulfil, and some limitation as well, but its will work pretty well
the qestion remains, of course, how do you plant this applet in every browser page the user goes too. :-)
Business Accounts
Answer for Membership
by: omry_yPosted on 2001-02-05 at 13:16:52ID: 5814987
try getDocumentBase()
(java.applet.Applet method)