admin管理员组文章数量:1355099
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'})();");
}
});
本文标签: javascriptSet html page padding in android WebViewStack Overflow
版权声明:本文标题:javascript - Set html page padding in android WebView - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743942677a2565852.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论