Sub ExecuteScript(WebView As WebView, Script As String) As String
Dim jo As JavaObject
jo = WebView
Dim engine As JavaObject = jo.RunMethodJO("getEngine",Null)
Return engine.RunMethod("executeScript",Array As String(Script))
End Sub
Sub InjectCSS(WebView As WebView, CSSText As String)
CSSText = CSSText.Replace("'",QUOTE)
Dim lines() As String = Regex.Split(CRLF,CSSText)
For i = 0 To lines.Length - 1
lines(i) = lines(i).Trim & "\"
Log(lines(i))
Next
CSSText = ""
For i = 0 To lines.length - 1
CSSText = CSSText & lines(i)
If i < lines.Length - 1 Then CSSText = CSSText & CRLF
Next
CSSText = CSSText.SubString2(0,CSSText.LastIndexOf("\"))
Log("var cssText = '" & CSSText & "'; var css = document.createElement('style'); css.type = 'text/css'; css.innerText = cssText; document.body.appendChild(css);")
ExecuteScript(WebView,"var cssText = '" & CSSText & "'; var css = document.createElement('style'); css.type = 'text/css'; css.innerText = cssText; document.body.appendChild(css);")
End Sub