Skip to content

Instantly share code, notes, and snippets.

View shuixingge's full-sized avatar

shuixingge shuixingge

View GitHub Profile
@jamesjara
jamesjara / webviewclient.java
Created March 30, 2015 05:54
Android inject js or css to external page webview
//---- Appened STYLE
//document.getElementsByTagName('html')[0].innerHTML+='<style>*{color:#fff}</style>'
StringBuilder extraStyles = new StringBuilder();
extraStyles.append("javascript:(function extra(){");
if(getResources().getBoolean(R.bool.extraCss)){
extraStyles.append(
"var aa =document.createElement(\"link\");" +
"aa.type='text/css'; aa.rel='stylesheet'; "+
"aa.href='"+getResources().getString(R.string.extraCssUrl)+"';"+
"document.getElementsByTagName(\"head\")[0].appendChild(aa);"