the two ways that I know to get the page url are:
1.through the applet class:
Applet.getDocumentBase()
2.through the netscape javascript library:
JSObject.getWindow(this).eval(“location.href”)
First, what are the differences between those two methods and advantages of each,
Secondly, can users trick the url of those methods in someway? to make the applet think it’s embeded in http://www.stackoverflow.com/index.html for example?
If you look at the code for
Applet.getDocumentBase()(sun’s implementation ofAppletStub), you’ll see that it is also getting the location usingJSObject. But it has a lot of additional code around it, and is guaranteed to work across all browsers and setups. So better useApplet.getDocumentBase()