User-474980206 posted
you can not catch a javascript out of memory error. The user must manually reload the page. You should design the page to not exceed memory. You can check file size before access.
in javascript there is no limit on upload file size, even when using ajax. if you are changing the file to a data url, you need to check the size first.