Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have an image that the user drew on a canvas and i want to save that image on the server.

These lines work well on my ipad but not on my android(ver 2.3.3) browser:

var testCanvas = document.getElementById("sketchpad");  
var canvasData = testCanvas.toDataURL("image/png");

If i alert canvasData i only get:

data:,

Am I missing something? Is it possible to do on android or should i be looking at other methods, plugins, etc?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
556 views
Welcome To Ask or Share your Answers For Others

1 Answer

Unfortunately it isn't supported in your version (i think it's only supported in ICS), have a look at this issue reported

http://code.google.com/p/android/issues/detail?id=16829

There is supposed to be some sort of JavaScript implementation to add support for it, but i haven't tried it myself

http://code.google.com/p/todataurl-png-js/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...