I'd like to set top padding in a html source using JS function.The point is to not reload the page when this function will take effect, that's why I supposed to use innerHTML
property.
My actual source is:
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView web, String url) {
web.loadUrl("javascript:(function(){document.body.innerHTML = document.body.innerHTML.style.paddingTop = 100px");
}
});
this solution is not working, giving me warning:
I/chromium: [INFO:async_pixel_transfer_manager_android(56)] Async pixel transfers not supported
I'd like to set top padding in a html source using JS function.The point is to not reload the page when this function will take effect, that's why I supposed to use innerHTML
property.
My actual source is:
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView web, String url) {
web.loadUrl("javascript:(function(){document.body.innerHTML = document.body.innerHTML.style.paddingTop = 100px");
}
});
this solution is not working, giving me warning:
I/chromium: [INFO:async_pixel_transfer_manager_android(56)] Async pixel transfers not supported
Share
Improve this question
edited Nov 16, 2015 at 10:54
Vasile Doe
asked Nov 16, 2015 at 10:47
Vasile DoeVasile Doe
1,7541 gold badge26 silver badges44 bronze badges
1 Answer
Reset to default 11You need to write
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView web, String url) {
web.loadUrl("javascript:(function(){ document.body.style.paddingTop = '100px'})();");
}
});