GetLocation Function (BrowserChild HtmlImage HtmlLink)

Class

BrowserChild, HtmlImage, and HtmlLink.

Action

Returns the URL for the specified page, image, or link.

Availability

This functionality is supported only if you are using the Classic Agent.

Syntax

sLocation = object.GetLocation ( )
Variable Description
sLocation The full URL. STRING.

Notes

GetLocation only applies to an HtmlImage object if the entire object is clickable and linked to one URL. If the image does not contain a link you will receive an error message.

GetLocation(), like SetActive(), only works on top-level BrowserChildren.

An image link consists of an image and an associated anchor link. The target URL is the HREF attribute of the anchor link, not of the image itself. To get the URL, call GetLocation() for either the image or the anchor link, or call GetProperty("$Location") for the anchor link. To get the image file name, call GetFileName() or GetProperty("$Href") for the image.

Note that both the image and the anchor link have the same rectangle, so when you verify properties and point at the image, you usually will verify the image rather than the anchor link.

Example

The following example uses GetLocation with a BrowserChild, HtmlImage, and HtmlLink, using the browser test page of the GMO Web application, where [...] is the complete path of the files.

Print (TestPage.GetLocation ()) //BrowserChild
Print (TestPage.JavaAppletImg.GetLocation ()) // HtmlImage
Print (TestPage.LetUsKnowLink.GetLocation ()) // HtmlLink
// Results:
// http://[...]/browser-test.htm
// http://[...]/javaapplet.htm
// mailto:gmo-master@borland.com