Class WAnchor

Direct Known Subclasses:
IndexAnchor

public class WAnchor extends WContainerWidget
A widget that represents an HTML anchor (to link to other documents).

Use an anchor to link to another web page, document, internal application path or a resource (which specifies application-dependent content that may be generated by your application on demand). The anchor may contain a label text, an image, or any other widget (as it inherits from WContainerWidget).

If you link to a document or external url, and do not want the application to terminate when the user follows the anchor, you must use link.setTarget(LinkTarget::NewWindow). Even for non-HTML documents, this may be important since pending Ajax requests are cancelled if documents are not served within the browser window in certain browsers.

WAnchor is an inline widget.

CSS

The widget corresponds to the HTML <a> tag and does not provide styling. It can be styled using inline or external CSS as appropriate.