This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Difference between getDocumentBase() and getCodebase() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference between getDocumentBase() and getCodebase() " Watch "Difference between getDocumentBase() and getCodebase() " New topic

Difference between getDocumentBase() and getCodebase()

Mike Liu

Joined: Jan 24, 2002
Posts: 3
Hi, Can anybody tell me the deffience between getDocumentBase() and getCodeBase().
Thank you.
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
Blatantly copied from javadoc...
Returns an absolute URL naming the directory of the document in which the applet is embedded. For example, suppose an applet is contained within the document:

The document base is:

Gets the base URL. This is the URL of the applet itself.
[ February 20, 2002: Message edited by: Rob Ross ]

SCJP 1.4
Mike Liu

Joined: Jan 24, 2002
Posts: 3
Thank you Rob, you know I am kind of new in java, can you give me one example on this. thank you again.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Welcome to the Java Ranch, we hope you’ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!

I agree. Here's the link:
subject: Difference between getDocumentBase() and getCodebase()
jQuery in Action, 3rd edition