I'm trying to add more empty space to a loaded WebView using JavaScript.
I load data using loadDataWithBaseUrl() from a String resource.
Then, after measuring some content, I need to make WebView bigger, say for 100 pixels.
So I call javascript function using loadDataWithBaseUrl():
mWebView.loadUrl("javascript:addHeight()");
Javascript function is defined in the original HTML:
function addHeight() { " +
var elemDiv = document.createElement('div');
elemDiv.style.cssText = 'height:100px;';
document.body.appendChild(elemDiv);
}
After this, WebView resizes itself to fit the new content. However, resulting height is not originalSize + 100px, but bigger.
I don't know where's the problem. I can't determine the target size, because it depends on the size of the appended div and it will be always different.
Has anybody tried this? Are you familiar with this behaviour?