James, Have you verified your JavaScript isn't already executed before this event occurs?
-Dan On Jan 20, 9:43 am, jamesh <jameshug...@gmail.com> wrote: > Hi, > > I'm trying to add Java objects to a WebView, such that they are > available to Javascript. > > I can prove that if I do: > > mWebView.addJavascriptInterface(myAvailableAtLoadTimeObject, > "MyJavaObject"); > mWebView.load("file:///android_assets/index.html"); > > I can call methods from Javascript: > > MyJavaObject.callableFunction(); // callableFunction is a Java method > on myAvailableAtLoadTimeObject. > > or from Java: > mWebView.loadUrl("javascript:MyJavaObject.callableFunction();"); > > However, if WebViewClient.onPageFinished() has occurred, and then I > try: > > mWebView.addJavascriptInterface(myAvailableOnlyLaterObject, > "MyLateJavaObject"); > mWebView.loadUrl("javascript:MyLateJavaObject.callableFunction();"); > > I get an error reported from Javascript: > Uncaught ReferenceError: MyLateJavaObject is not defined > > What am I missing, or doing wrong? > > Thanks, > > James -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en