简体   繁体   中英

Receive message from JavaScript WebView in Objective-C

I have a WebView with a JavaScript function loadStuff , that makes some ajax calls.

In my AppDelegate, I've managed to to use WebView's stringByEvaluatingJavaScriptFromString to execute loadStuff.

Now my problem is I want to execute some Objective-C code once the JavaScript ajax stuff is done. How can my JavaScript notify back the native code?

如果您有权访问AJAX成功处理程序,则可以强制Webview从中打开一些伪造的url,然后从委托的shouldStartLoadWithRequest中进行处理。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM