开发者

Javascript and rendering pauses and stays paused on scroll in the android browser

开发者 https://www.devze.com 2023-01-03 01:11 出处:网络
I\'ve found some wierd behaviour related to scrolling and rendering and javascript. How to make it happen:

I've found some wierd behaviour related to scrolling and rendering and javascript.

How to make it happen:

On any webpage that is long enough to scroll on. Start to scroll pretty fast (fling the page). then release the touch. Now while the page is still scrolling because of the momentum. Tap the screen to stop the scroll.

This make the browser enter a wierd mode.

On the nexus one it behaves like this: The updating of what's shown on the screen stops, you can still click on links and the go to where they are supposed to but what's shown on the screen stays the same.

If you then scroll the screen a bit the update of the screen kicks in again and what you you where suppsed to see all the time is 开发者_开发问答shown.

On all phones with HTC Sense I've tried (Hero, Desire, Legend) this happens:

The updating of the screen is stopped just like on the nexus one, but also the execution of any javascript is stopped. If you click on a link that takes you to another page however things return to normal again.

The way I tested this was I created a page like this:

http://pastebin.ca/1881620

The changeColor function simply changed the background color of 'container' to a few different colors.

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

after the error this happens:

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

On Sense: The links take me to google.com

Has anyone else noticed this problem? Is there anyway to work around it?

Thanks.


You could try using a plugin that manipulates the browser's scrolling process, such as iScroll4.

iScroll4 let us do some pretty cool stuff (like fixed headers/footers), but it did have some performance problems in some of the older/crappier Android phones...

I can't guarantee that it'd fix your problem, and it'd be kind of a last resort, but it might be worth trying if you're interested in iScroll's other features, or if you've hit a dead end with your bug, and it's a show-stopper for your app.

0

精彩评论

暂无评论...
验证码 换一张
取 消