Javascript and rendering are paused and remain paused in scrolling in Android browser

I found some weird behavior related to scrolling and rendering and javascript.

How to do it:

On any webpage long enough to scroll. Start scrolling pretty fast (turning the page). then release the touch. Now, while the page is still scrolling due to the momentum. Tap the screen to stop scrolling.

This will cause the browser to enter wierd mode.

In this regard, it behaves like this: The update of what is displayed on the screen stops, you can still click on the links and go where they should, but what is shown on the screen remains the same.

If you then scroll the screen a bit, the screen update will start to sound again, and you will see that you are where you wanted to see all the time.

On all phones with HTC Sense, I tried (Hero, Desire, Legend):

Screen refresh stops just like one of them, but any javascript also stops. If you click on the link that leads you to another page, everything will return to its normal state again.

As I tested this, I created a page like this:

http://pastebin.ca/1881620

The changeColor function simply changed the background color of the "container" to several different colors.

So, before the error, what happens is that when you click on any link, the color changes.

after an error, this will happen:

Nexus one: when you click on links, nothing happens (except that the "orange link selected rounded corner thing" is displayed as if the link was clicked). Then when you scroll abit. You can see that the color has changed (and an equal number of times by the number of times I clicked the link).

I mean: Links take me to google.com

Has anyone else noticed this problem? Is there any way around this?

Thanks.

+4
source share
1 answer

You can try using a plugin that controls the browser scroll process, such as iScroll4 .

iScroll4 allows us to do pretty cool things (like fixed headers / footers), but it really had performance issues on some older Android / crappier phones ...

I can’t guarantee that it will fix your problem, and this will be partly the last, but it may be worth a try if you are interested in other iScroll functions, or if you are stuck with your error, and this is a show stopper for your application .

0
source

Source: https://habr.com/ru/post/1312642/


All Articles