如何中检索中的WebView组件Java脚本函数值 [英] How to retreive java script function value in webview component

查看:113
本文介绍了如何中检索中的WebView组件Java脚本函数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检索网页中的Java脚本函数值加载withing一个web视图组件??

How can I retrieve the java script function value from a web page loaded withing a webview component??

推荐答案

您不能直接。

您可以通过调用使用loadURL Javascript函数(JavaScript的:...),其中 ... 是函数调用。但是,你不能因此这种方式。

You can call the Javascript function via loadUrl("javascript:..."), where ... is your function call. However, you cannot get a result this way.

如果您通过 addJavascriptInterface注入一个Java对象到网页(),你可以设置一个名为你想要的功能,并通过调用返回一个值,另一个函数所注入的Java对象。这只是工作,如果你可以修改网页,但。

If you inject a Java object into the Web page via addJavascriptInterface(), you could set up another function that called the function you want and returns that value via a call to the injected Java object. That only works if you can modify the Web page, though.

这篇关于如何中检索中的WebView组件Java脚本函数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆