Regex Rookie
Regex Rookie

Reputation: 10662

HTML + Javascript Renderer that outputs HTML or plaintext?

If I use:

String plain = Html.fromHtml(html).toString;

to render simple 'html' that contains:

<!doctype html>
<html>
  <head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Google</title>
  </head>
  <body>any plain vanila HTML goes here
  </body>

All is nice and dandy.

But what if that page contains tons of Javascript code that is nicely rendered by all web browsers but isn't available to me?

Is there a renderer that takes care of the Javascript as well, to output HTML or plaintext, that isn't necessarily going to a visual display?

(I know about WebView but my understanding that I can't really access its output. Or can I?)

Upvotes: 2

Views: 995

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006654

Is there a renderer that takes care of the Javascript as well, to output HTML or plaintext, that isn't necessarily going to a visual display?

WebView or bust.

(I know about WebView but my understanding that I can't really access its output. Or can I?)

  1. Create a Java object to receive your output
  2. Add that Java object to the WebView via addJavascriptInterface()
  3. Use loadUrl("javascript:...") on the WebView to invoke a hunk of Javascript that gathers your information and calls a method on your Java object

Upvotes: 1

Related Questions