I have a couple of html forms inside of an Android app.
To hide the background image of the app on the webview the height of the html page is set to 1000px via CSS (it’s also set to 100% via Java for the webview, but that does not always work).
Problem:
Form A on page 1 is rather long, the submitbutton is at the end of the page. Form B on page 2 is short.
After posting form A the app does not scroll to the top of page 2 but stays at the same position. As post B is short the user sees nothing but the empty background. Not good.
We tried the following methods:
- pageUp (from the Java SDK)
- scrollTo() (from the Java SDK)
- insert a “
<a name="top"></a>” in the html code of the forms and use"window.location.hash="top"from within the app to address the anchor
The last way works almost everywhere but not on Samsung devices (reported as broken with Samsung S2 and Ace). Are there other options we might have missed?
We ended up removing the 1000px css hack.