HTML and CSS Reference
In-Depth Information
SVG
W
eb is a
J
ava
S
cript library that, if it detects the browser has no
native support for
SVG
, will replace any
SVG
graphics it finds with a
Flash movie. The Flash movie will then take care of rendering the
SVG
in the browser. You have to make some slight modifications to your
web page in order to enable
SVG
W
eb. The first is in the head of the
document, where you reference the
SVG
W
eb
J
ava
S
cript library:
<script src="svg.js"></script>
Then you have to surround each of your
SVG
graphics with
<script>
tags:
<script type="image/svg+xml">
<svg viewBox="0 0 320 240">
<rect x="50" y="50" width="100" height="100"
style="fill: rgb(255,0,0)"></rect>
<line x1="50" y1="50" x2="150" y2="150"
style="stroke: rgb(0,127,127); stroke-width: 5;"></line>
</svg>
</script>
Your
SVG
graphics will then render as
SVG
in browsers that support it
and as Flash movies in browsers that don't support
SVG
. In the follow-
ing examples, at left you can see that
SVG
W
eb allows Internet
Explorer to render inline
SVG
, although it doesn't match the native
support offered by browsers such as Firefox (shown on the right).