WKWebView and window.open

前端 未结 1 1433
甜味超标
甜味超标 2021-01-01 13:05

It appears that a lot of links on websites use window.open in their onclick handlers but WKWebView seems to completely ignore window.open.

Is there a workaround for

相关标签:
1条回答
  • When a web application calls window.open() in JavaScript, the WKWebView will call the - webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures: method on its UIDelegate.

    In that delegate method you should create a new WKWebView with the WKWebViewConfiguration that is given to you. If you present this new WKWebView on screen, it will load with the correct content.

    This is documented in the WKUIDelegate documentation, although it is not very explicit that this is called as a result of window.open().

    0 讨论(0)
提交回复
热议问题