Canvas HTML5 - Saving as Image!?


hopefully i can find help here :slight_smile:
I want to save my canvas-content to a single image-file. There are an approach using todataurl(), which works fine. But not if i draw an image-file (e.g. car.jpg or house.png) to the canvas additionally. It does not return the whole image? Here I have my simple example-code:

window.onload = function()

        var canvas = document.getElementById("theCanvas");
        var context = canvas.getContext("2d");
		context.fillStyle = "navy";
        var imagefile = new Image();
		imagefile.onload = function () 
			context.drawImage(imagefile, 22, 0,60,60);
		imagefile.src = "";'image/png'));	


<body id=โ€œbodiโ€>
<canvas id=โ€œtheCanvasโ€ width=โ€œ500โ€ height=โ€œ200โ€ >

Only the HTML5-methods like fillRect() are rendered to the new window, why this is so? What im doing wrong?
Thanx in advance for help

Moved to JS forum as seems more appropriate.