Merge pull request #10 from jfollas/master

Workaround for older browser security exception using toDataURL() with parameters
This commit is contained in:
ericdrowell 2012-04-01 09:21:10 -07:00
commit 6889cd742c

View File

@ -161,7 +161,15 @@ Kinetic.Stage.prototype = {
addLayer(n);
}
else {
callback(bufferLayer.getCanvas().toDataURL(mimeType, quality));
try {
// If this call fails (due to browser bug, like in Firefox 3.6),
// then revert to previous no-parameter image/png behavior
callback(bufferLayer.getCanvas().toDataURL(mimeType, quality));
}
catch(exception)
{
callback(bufferLayer.getCanvas().toDataURL());
}
}
};
imageObj.src = dataURL;