Android's addJavascriptInterface equivalent in iOS

前端 未结 2 1336
隐瞒了意图╮
隐瞒了意图╮ 2021-02-07 10:33

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

the question is,

2条回答
  •  我在风中等你
    2021-02-07 10:56

    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.

提交回复
热议问题