I am using following code for capture photo and display/store. This same code working fine in iPhone 5 with iOS 7.1.2 but in iPhone 4S with iOS 8.1 safari will crash every time when i take photo.
<body> <img id="uploadPreview" style="width: 100px; height: 100px;"> <input id="uploadImage" type="file" name="myPhoto" onchange="PreviewImage();"> <script type="text/javascript"> function PreviewImage() { var oFReader = new FileReader(); oFReader.readAsDataURL(document.getElementById("uploadImage").files[0]); oFReader.onload = function (oFREvent) { document.getElementById("uploadPreview").src = oFREvent.target.result; }; }; </script> </body>
Demo
Following message show in safari after take photo
A problem occurred with this webpage so it was reloaded
Update Now i am doing same task on same device but with iOS version 8.1.2. Still same problem occured
Safari accumulates caches, browsing history, cookies, and other data in the iPhone or iPad. Sometimes that data can interfere with app functionality, so clearing it out can be a remedy to problems with the app crashing or stalling on some web sites.
Although the 8.1 update fixed it on newer devices, on older devices (first iPad, iPad Mini, iPhone 4S) the problem still existed. iOS 8.2 didn't do a better job. However, with the release of 8.3 yesterday, the problem was resolved. Prior to the 8.3 update I checked with iOS 8.2 and with every picture safari crashed. Sometimes during the camera mode, sometimes after the picture was taken. Hopefully the problem is now resolved for others as well.
For the other devices a factory restore did resolve the problem, but also removed any app, settings and data. Not really the way to go.
The code I used for testing can be found in this fiddle: http://jsfiddle.net/d6nwubx3/6/
var inputComponent = document.getElementById('fileuploader'); inputComponent.addEventListener('change',handleFileSelect, false); function handleFileSelect( event ) { var image = event.target.files[0]; // Do something with image }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With