iPhone bug with window.alert in web apps

I thought I had a crazy bug. My iPhone tester reported that after closing a pop-up alert, the app would force close. This got me really worried since I don’t think I could cause a browser to crash even if I tried!

It turns out various flavours of iOS have a bug whereby alert/confirm in an event handler would cause the browser to shutdown. C’mon apple! It’s bugs like these that cause developers to have to create crazy workarounds to make things work across browser. The workaround in this case for AngularJS is to delay the alert

$timeout(function(){window.alert('My alert');});

Leave a Reply

Your email address will not be published. Required fields are marked *