Oh sorry, one more thing to mention.
If I use webView.loadUrl("javascript:alert('xx')"), it will send alert
message to my WebChromeClient.
That is, loadUrl can indeed execute javascript but cannot execute
javascript "in the custom generated HTML string".
Any ideas?

On 7月8日, 下午8時23分, treetop <[email protected]> wrote:
> Hi, I have put HTML document into a string variable and load it by
> using webView.loadDataWithBaseURL(null, htmlString, "text/html",
> "utf-8", null). After that, I tried two ways and want to execute
> javascript function "exec()" by using
> 1.  webView.loadDataWithBaseURL(null, "javascript:exec()", "text/
> html", "utf-8", null) -> This will overlap the  content of previous
> "htmlString" and shows "javascript:exec()" on the screen.
> 2. webView.loadUrl("javascript:exec()") -> There will be "Can't find
> variable: exec line: ..." in Logcat
> Besides, I have tried to output "htmlString" to a file located in
> sdcard, and tried to use webView.loadUrl("file:///sdcard/xxx/a.xhtml")
> + webView.loadUrl("javascript:exec()"). And...it fails again!
> Could anybody help me figure out how to execute javascript function
> after loading html content by "loadDataWithBaseURL"? Thanks a lot!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to