简体   繁体   中英

ios - how to open a swift view using javascript in a web view?

In my app, I have a webview, and I would like to have a button that will open another view in Swift. Is there a way to use have that button in the webview itself and use javascript to have it segue to the next view? If so, how can I implement this?

Use webViewJavaScript bridge classes and use it functions and web view delegate methods for interacting.

objective C link https://github.com/lokimeyburg/WebViewJavascriptBridge for swift use it by simply importing #import "WebViewJavascriptBridge.h" in your AppName-bridging-header.h

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