0

How can i detect that a modal window pops up on WKWebView. I need to detect because I need to disable the back and menu button?

I have used the WKWebView delegates, but none is called when modal window pops up. WKWebView delegates are called only when browser reloads.

Please find the screenshot. enter image description here

Nilesh Kumar
  • 2,141
  • 3
  • 16
  • 20
  • 2
    Your modal window seems to be a pure Javascript / HTML implementation. So you have no hooks in iOS to catch these event homogeneously. If you know or control the corresponding Javascript code you can inject additional Javascript code from iOS to send custom events on opening and closing these windows. – clemens Dec 04 '17 at 06:58
  • Thanks @clemens for your prompt reply. I will look into your suggestion and try to work it round. – Nilesh Kumar Dec 04 '17 at 07:09
  • You should take a look on [message handlers and user scripts](https://developer.apple.com/documentation/webkit/wkusercontentcontroller) too. – clemens Dec 04 '17 at 07:13
  • okay..sure I will have a look :) – Nilesh Kumar Dec 04 '17 at 11:08
  • Hello @clemens following link helped me to solve my issue, as per your suggestion to look into message handlers and user scripts topic. https://stackoverflow.com/questions/25827368/swift-webview-how-to-call-correctly-swift-code-from-javascript – Nilesh Kumar Dec 04 '17 at 12:58

0 Answers0