Android (3.0 and later) supports SVG with ECMAScript.
The problem is that ecmacript in svg fails when svg is added to the <img> . I also tested it in several desktop browsers, and when svg is in the <img> , ecmascript was not executed in any of them.
There are 5 ways to add svg to html:
- Add it as an image with the
<img> - Paste it with the
<embed> - Paste it with an
<iframe> - Paste it with the
<object> - Embed svg code directly in html (using the
<svg> )
A script in svg is only executed if svg is embedded in the <embed> , <iframe> or <object> tags. When embedding svg code directly in the <svg> may need to make some code changes (for example, moving scripts elsewhere in html), but it should also work.
Tomik source share