sorry for the delay, I will check it shortly.
Main Topics
Browse All Topicsfrom my applet, I need to get the url of the html document using JSObject.
(I cannot use applet.getDocumentBase(), because it can be fooled with an html BASE tag).
for explorer I have a working solution, but in netscape, the following code does not work, href turns out to be null.
JSObject window = getWindow(applet);
JSObject location = (JSObject)window.getMember
Object href = location.getMember("href")
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.
Business Accounts
Answer for Membership
by: garyz31Posted on 2002-04-20 at 14:40:12ID: 6956809
This works on Internet Explorer and Navigator:
ct js ;
ct.getWind ow(this) ; oString() ; JSExceptio n e)
---------- ----------
---------- ---------- ---
Java class code:
import java.applet.Applet ;
import netscape.javascript.* ;
import java.awt.* ;
import java.lang.String ;
public class AppTest extends java.applet.Applet
{
private String pageURL ;
public netscape.javascript.JSObje
public void init()
{ try
{
JSObject js = netscape.javascript.JSObje
pageURL = js.getMember("location").t
}
catch(netscape.javascript.
{ e.printStackTrace() ; }
}
public void paint(Graphics g)
{ g.drawString(pageURL, 10, 10) ;
}
}//class end
--------------------------
HTML code:
<HTML>
<HEAD>
</HEAD>f
<BODY>
<Applet code="AppTest.class" width=400 height=200 id=OBJECT1
MayScript VIEWASTEXT>
</Applet>
</BODY>
</HTML>
--------------------------
Hope this helps.