Screenshot game canvas and upload/save image

hello developing a game that requires screenshots of the canvas , anyone have any idea how to do this on cocos2d-HTML5 , afterwards it would be required to be uploaded on facebook

It’s easier than I thought:

var canvasElement = cc.$("canvas");
var image = new Image();
image.src = canvasElement.toDataURL("image/png");

Note that the conversion proccess (the toDataURL) takes a little while, so you should implement some sort of waiting dialog and a callback for when it’s finished. You can test that this works easily by “opening” the generated image in the browser like this: window.location.replace(canvasElement.toDataURL("image/png"));.

Does anyone know if there’s a better way for getting the canvas element?

Hello,

I tried with above code. This works fine for me in chrome browser and safari browser.
But when i check in IPAD device safari browser am getting white image.

Is the above code works fine for you in Ipad devices?

Thanks in advance.