0

I have an ios app built from gonative.io (essentially they use a webview to load in the app a website content). I'm trying to call a javascript function to set username and password (or set them directly from the ios oproject) if the user already logged in. Anyone know how can I do that? Thanks a lot.

Nigel Fds
  • 763
  • 1
  • 11
  • 27
fabiokz
  • 31
  • 1
  • 6
  • refer to this post [execute javascript in ios](https://stackoverflow.com/q/26778955/6521116) and [javascript in webview](https://stackoverflow.com/q/41488423/6521116) – LF00 May 29 '17 at 06:31

1 Answers1

0

You can use WKWebview's evaluateJavaScript. You also can refer my post here.

self.wk.evaluateJavaScript("var rect = document.getElementById('movie').getBoundingClientRect(); [rect.x, rect.y, rect.width, rect.height, rect.top, rect.right, rect.bottom, rect.left];") { (result, error) -> Void in
        print(result)
}
LF00
  • 24,667
  • 25
  • 136
  • 263