How to render DIV content on Html5 Canvas

i got a code which may render div content on canvas but many area i just do not understand. so guide me. here is the code which i got it.

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var data = "data:image/svg+xml," +
           "<svg xmlns='' width='200' height='200'>" +
             "<foreignObject width='100%' height='100%'>" +
               "<div xmlns='' style='font-size:12px'>" +
                "<ul> <li style='color:red'> hello </li>  <li style='color:green'>thomas</li> </ul> "  +   
               "</div>" +
             "</foreignObject>" +

var img = new Image();
img.src = data;
img.onload = function() { ctx.drawImage(img, 0, 0); }

1) what is the meaning of data:image/svg+xml 2) what is the meaning of <svg xmlns='' width='200' height='200'>

3) what is <foreignObject width='100%' height='100%'>

if possible please explain their meaning & usage.

another most important issue that Canvas & browser compatibility issue we know that many browser version do not support html5 Canvas and in that case we can fallback and load flash canvas

so guide me how to load flash canvas and also the most important is to draw or render div content on flash canvas.

looking for guidance in detail. thanks


When it is not the root element, the svg element can be used to nest a standalone SVG fragment inside the current document (which can be an HTML document). This standalone fragment has its own viewPort and its own coordinate system.

The foreignObject element allows for inclusion of a foreign XML namespace which has its graphical content drawn by a different user agent. The included foreign graphical content is subject to SVG transformations and compositing.

you can find source from this link

Need Your Help

Session shared in between tabs

jsp session java-ee browser-tab

I have JAVA web application where I need to stop session being shared between browser tabs, meaning

How could retrieve the specific row from HIVE table?


I have table of 200 rows and 50 columns in a HIVE table.