Take the 2-minute tour ×

A few questions here:

  1. Is there anyway to keep iOS from freezing javascript on the page while scrolling?

  2. Does iOS freeze javascript when your in another tab or if you switch apps?

  3. Are there any other major javascript limitations on iOS?

share|improve this question
add comment

2 Answers

iOS 6.x suspends all event timers in response to touch events like scrolling and has a tendency not to start up all the timers again once the event is done. It's a well known iOS 6 bug that is super-annoying. It pretty much breaks parallax and stuff. Some people have resorted to building their own scroll functionality.

Here's another StackOverflow on the same topic: iOS 6 safari, setInterval doesn't get fired

and another: setInterval pauses in iphone/ipad (mobile Safari) during scrolling

and here is the closest thing you'll get to a bug report on it (Apple doesn't make bug reports public to maintain the illusion of perfection, so developers made their own bug site): http://openradar.appspot.com/12756410

This bit of code will unfreeze timers that are broken / lost / destroyed by iOS during a page scroll: https://gist.github.com/ronkorving/3755461

This is another attempt to fix the freeze: iOS 6 js events function not called if has setTimeout in it

Unfortunately, there is nothing you can do to fire events WHILE page scrolling. Like fade out a back-to-top link when scrolling up the page. When it comes to scrolling, iOS6 is incapable of rubbing it's tummy and patting it's head. (iOS5 works fine, btw. This is a regression)

share|improve this answer
There's another workaround mentioned here: stackoverflow.com/questions/10482227/… -> build your own scroll function... –  chaenu Jan 27 at 14:41
add comment

To answer the third question, a decent-sized limitation is that sometimes innerHTML just plain doesn't work. From the accepted answer:

It happens when the CPU of the phone is very busy (say 100%). Then the rendering engine sometimes forget about innerHTML settings.

The solution included in my unify project is to test if there is an element in childNodes, otherwise apply it again.

share|improve this answer
John McKerrell blogged about the Mobile Safari innerHTML bug way back in 2007, as well. –  sdleihssirhc Dec 2 '11 at 20:02
add comment

Your Answer


