Basically, I am developing an Android application where a user can access the contents of an HTML page and choose what to do with it, whether it is writing to a file system, downloading via FTP, etc. the user cannot see the HTML, but he saves it for viewing later.
I tried to add a JavaScript interface and then add it to the onPageFinished event, it just doesn’t want to pass HTML, here is what I did:
so for my onPageFinished event:
Webview wv = (WebView) findViewById(R.id.webbrowser);
wv.addJavascriptInterface(new JSEngine() , "JSEngine");
public void onPageFinished(WebView wv , String html){
wv.loadUrl("javascript: window.JSEngine.processHTML(document.body.innerHTML)");
}
the code to execute inside processHTML cannot be split for certain reasons, but I can tell you that the html variable is empty.
then my javascript interface:
Class JSEngine{
@JavascriptInterface
public void processHTML(String html){
}
}
-, ? , , -, html.