Home > Mobile >  Call on the webview h5 private objects
Call on the webview h5 private objects

Time:02-04

Now know android webview with JS interaction, is through the

The class JsObject {
@ JavascriptInterface
Public String toString () {return "injectedObject"; }
}
WebView. AddJavascriptInterface (new JsObject (), "injectedObject");

I understand this method for is in the js object method calls a Java function, calls on the HTML injectedObject. The toString ();
but this is not I need
I was like this

The class JsObject {
@ JavascriptInterface
Public String toString () {return "injectedObject"; }
}
WebView. AddJavascriptInterface (JsObject (), "injectedObject");

On the HTML interface using var mo=new injectedObject (); Mo. ToString (), in HTML using the object way,


This is like a js object of default var arr=new array (); And so on,

Currently found only recompile the implementation on the webview? Don't know you have no solution,
The webview APK can be used in the root environment,

CodePudding user response:

Can provide the solution, thank you can use a red envelope,
  • Related