IOS Safari crashing with big mail

I have an HTML5 canvas element. I need to send a canvas image to my server. It works fine in all the PC browsers I tried, but iOS Safari crashes with an Out of Memory error in the log files. The canvas image is almost 500 KB, because it is 950x323 PNG. Here is a simplified version of my submit code:

$('#imageJSON').val(JSON.stringify(myCanvas)); //I wrote other JSON stringify code. It works
var d = myCanvas.toDataURL();
$('#imageData').val(d);
$('#myForm').submit();

Safari starts serving, but resets a few seconds to submit. The server receives other data with the request, but imageData is not complete. I tried changing the form's enctype form to "multipart / form-data", but that didn't help.

+5
source share
2 answers

, WebKit Mac . webkit.org https://bugs.webkit.org/show_bug.cgi?id=84168. AJAX .

$('#imageJSON').val(JSON.stringify(myCanvas)); 
var d = myCanvas.toDataURL();
$('#imageData').val(d);
var data = $(form).serialize();
$.post(ajaxurl, data, function(r) {
    // done. handle response. remove loading overlay.
});

, . javascript ( ), , , .

+3

, ? , , toDataURL() , 10-20 . . , . .

+1

All Articles