Android的addJavascriptInterface相当于iOS中 [英] Android's addJavascriptInterface equivalent in iOS

查看:339
本文介绍了Android的addJavascriptInterface相当于iOS中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如你可能知道,Android的的WebView有一个名为方法 addJavascriptInterface()进口一个Android Java对象的Javascript环境。

As you may know, Android's WebView has a method named addJavascriptInterface() which imports an Android JAVA object to Javascript context.

问题是,是否有它的iOS任何等价?

the question is, Is there any equivalent of it on iOS?

推荐答案

UIWebView的iOS上没有方法接口添加到DOM。
但你还是可以跟你的code从JavaScript分配的东西 window.location的和处理该请求web视图:shouldStartLoadWithRequest:navigationType:委托方法。

UIWebView on iOS doesn't have methods to add interface to DOM.
But you still can talk to your code from javascript assigning something to window.location and handling that request in webView:shouldStartLoadWithRequest:navigationType: delegate method.

这篇关于Android的addJavascriptInterface相当于iOS中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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