IOS – Does anyone know how iOS Safari 9 handles page crashes or freezing

hangiossafari

We have a web app which is freezing in Safari 9 and Safari 10 on iOS 9 and 10. Worth noting this is a web page which is touch responsive, the users then add this web page to the Home screen of the device by opening the page in Safari and clicking 'Add to Home Screen'.

The app seems to sometimes freeze in Safari 9 and Safari 10, and no buttons are clickable. From what I can see the actual device seems to lock up and freeze sometimes but recovers after 1 or 2 seconds, I've tested this by looking through the recent apps, and this seems to freeze, this is happening on multiple devices and we have a theory it could be due to a third party app causing the devices to freeze.

My theory is that when the actual device (iOS) is freezing for 1 or 2 seconds, that the device is trying to unfreeze itself and it kills all the scripts running in Safari which is causing our application not to recover from the freeze, does anyone know if this is how Safari actually works? Or if this theory is possible?

Thank you! 🙂

Best Answer

Apple engineers wrote the code, but it's not available for inspection so the larger context is yes there is a system but we don't get to see it.

You can look at the logs an iOS device generates by plugging it into Xcode on a Mac or the Apple Configurator. If you do that, you will see that when an application crashes entirely - there will be a log file (that optionally is sent to Apple) explaining what crashed on a technical level.

The second level of logging is when an app (Safari in this case) burns too much CPU. This is likely what you want - when a web page has excessive javascript, buggy javascript, continual tracking and acts more like a program than a short document to be rendered once - you will get a spin dump that again is mostly engineering data - but you will know the OS noticed the app was nor behaving like a short, quick efficient worker. The have spin in the file names.

Lastly, you can avail yourself of the well documented and very powerful Safari development tools by enabling debug and inspecting what Safari is doing on an extremely granular level to include errors, warnings, code inspection, timing to the millisecond, etc...