Increase content size of UIWebView using Javascript

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-05-27T11:38:02Z Indexed on 2010/05/27 11:41 UTC
Read the original article Hit count: 151

Hi folks,

I have a translucent toolbar over the bottom of my UIWebView. The trouble is, if there is a link at the bottom of the page, I can't press it because the webview will always bounce back down to the bottom.

I don't want to shrink the webview and use a solid colour toolbar, and UIWebViews interface doesn't open much up.

What I would like to do, ideally, is to actually increase the size of the web page by one toolbar height, so that I can scroll that extra bit and have all the content above the toolbar, but when scrolling down I will be able to see the page content through the toolbar. I could use the stringByEvaluatingJavaScriptFromString: function of UIWebView.

I'm very rusty on JavaScript- is it possible for me to do this? Increase the window height or something?

I tried:

 [webView stringByEvaluatingJavaScriptFromString: [NSString  stringWithFormat:@"window.resizeBy(0,%d);", TOOLBAR_HEIGHT] ];

but it didn't do anything.

Any pointers welcome. Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about iphone