The most basic form of interactivity is through the simple
use of the <a> element, which is analogous
to HTML's <a> element, to indicate links
(also known as hyperlinks or Web links). SVG uses XLink
for all link definitions. Everything contained within the
<a> and </a> elements is included
as part of the link.
Code Example
SVG Image
<?xml version="1.0"
standalone="no"?>
Right-click
on the image to open the SVG viewer pop-up menu.
Click 'view SVG' to display the image in a new, full
window to zoom & pan the image.
(SVG Viewer Tips)
<!DOCTYPE svg PUBLIC "-//W3C//DTD
SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
In the above examples, the text, rectangle,
and polygon elements all provide links to different
web pages. Any SVG element can act as a link. If you
move your mouse over these elements, notice that the
pointer changes accordingly, indicating this is a
link.
We use the target=new attribute in the polygon's
xlink to instruct the viewer to open up
a new browser window when it is clicked.