Can I use Data URLs in Android 2.1's Webkit-based browser?
- by Sven Haiges
Hi all,
I am writing a tutorial about the HTML5 Canvas for mobile and did some basic tests. While I can call the getDataURL() Method on an iPhone's HTML5 Canvas Element, it does not seem to return the data URL on Android 2.1 (Google Nexus One) and it's webkit-based default browser. Here is the sample:
var dataURL = canvas.toDataURL();
var img = document.createElement('img');
img.setAttribute('src', dataURL);
document.getElementById('box').appendChild(img);
This will work on iPhone, it will add a new image element with the same content as the canvas. It does nothing or fails on Android 2.1.
Has anyone ever gotten this to work?
I am also wondering if anyone could help me with understanding the WebKit Build numbers and what it means with regards to what features I can expect. For the iphone, I see a build number of 528.18, on Android 2.1's Browser I see (from the user agent strign) a WebKit build 530.17.
So it looks Android 2.1's webkit browser is more up to date, still some features work on iPhone's webkit but not on Android. Does this comparison just make no sense?
Thanx all!