I have been trying to solve this for a few hours now. The Javascript method above works if you want no scrolling at all, however if you want scrolling with no bounce it doesn't do the trick.
I tried using the document.ontouchmove event to dectect and stop the bounce but after some testing I noticed this stops firing when the bounce starts so it was no good for fixing this problem.
I have however found a fix, mostly by mining other stack overflow answers so a big thanks to the community. Please note I'm very new to Objective-C so please test this properly if you use it.
You can stop the bouncing but keep the scrolling by placing your UIWebView inside a UIScrollView and disabling the scrollviews bounces property.
Create the UIWebView like the following:
NSString *html = @"<html><head></head><body><div id=\"details\">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In non turpis tellus, ac tempus urna. Nunc fermentum nunc in felis cursus vel aliquam mi scelerisque. Nullam sollicitudin varius porta. Integer vel neque sapien. Vivamus ut sodales ligula. Nunc non sodales nibh. Integer vitae est diam. Nullam vehicula imperdiet congue. Aliquam interdum, urna tempus faucibus rutrum, tortor ante rutrum felis, id laoreet dolor velit vel lorem. Donec varius quam id turpis vulputate lobortis. Pellentesque vestibulum sodales pretium. Vivamus laoreet imperdiet condimentum. Donec ut felis non sem euismod commodo. Pellentesque id ante ac justo blandit luctus.\n\nMaecenas euismod tristique faucibus. Proin et tortor vulputate nibh congue pellentesque. Curabitur elit nulla, accumsan congue mollis non, tincidunt eget augue. Vivamus a dolor metus, eu ornare ligula. Quisque libero augue, iaculis quis imperdiet non, facilisis interdum nisi. Aliquam massa risus, varius euismod rutrum et, imperdiet vel ante. Vestibulum eu sapien aliquam purus rutrum ultrices porttitor non massa. Nam vestibulum est et sapien consectetur non consectetur nibh convallis. Mauris vulputate diam id leo eleifend fringilla. Integer et dui diam, sed ultricies leo. Nam massa lacus, auctor eget gravida nec, sollicitudin id augue. Quisque pellentesque elementum lectus, a placerat ipsum ultrices ac. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris id lectus turpis, nec aliquet felis. Nam aliquam ullamcorper dolor, sed euismod lacus feugiat eget. Curabitur commodo nulla augue, et dapibus neque.</div></body></html>";
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 290, 3000)];
webView.delegate = self;
[webView loadHTMLString:html baseURL:nil];
// Keep as an IVar as we need to set the content size later
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(5, 5, 290, 328)];
scrollView.bounces = NO;
[scrollView addSubview:webView];
Then add the following method to set the scrollview content size.
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSString *output = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('details').offsetHeight;"];
scrollView.contentSize = CGSizeMake(290, [output intValue] + 10);
}
I hope that helps.