In one of my iOS application I need to integrate a website, and I am successfully done that part, inside we have a option to deposit money to play the poker game for that we have two modes of payment 1. cashfree and 2. paytm. Though paytm mode I can able to do that part successfully, but through cashfree mode, I can't able to do it, out of my debugging I cam e to know that through the cashfree mode at the final stage, the website is trying to show a success or failure selection pop up in a new tab. From the WKWebView success or failure selection pop up is not loading.
I followed couple of solutions which are exist over different articles and forums but no luck.
below are my respective WKWebView references
I followed couple of solutions which are exist over different articles and forums but no luck.
below are my respective WKWebView references
Code Block @IBOutlet weak var wkWebView: WKWebView! var popupWebView : WKWebView?
Code Block func configureWebView(webViewName: WKWebView?, url: String) { if let webView = webViewName{ webView.isOpaque = false webView.uiDelegate = self webView.backgroundColor = colorLiteral(red: 0.1333333333, green: 0.1725490196, blue: 0.2352941176, alpha: 1) webView.allowsBackForwardNavigationGestures = true webView.navigationDelegate = self webView.allowsBackForwardNavigationGestures = true webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true webView.configuration.preferences.javaScriptEnabled = true if let cookie = getCookies() { webView.configuration.websiteDataStore.httpCookieStore.setCookie(cookie) } if let url = URL(string: url) { webView.load(URLRequest(url: url)) startTimer() } } } /*MARK: Getting called when intended url is about to load in from the delegate method of WKWebview, that is createWebViewWith configuration */ func createPopupWebView(for url: String, config: WKWebViewConfiguration) { popupWebView = WKWebView(frame: CGRect(x: 50, y: 50, width: view.bounds.width - 150, height: view.bounds.height - 150)) popupWebView = WKWebView(frame: view.bounds) popupWebView?.autoresizingMask = [.flexibleWidth, .flexibleHeight] configureWebView(webViewName: popupWebView, url: url) }
Code Block //MARK: - WKUIDelegate delegates extension HomeViewController: WKUIDelegate { func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { if navigationAction.targetFrame == nil { if let urlStr = navigationAction.request.url?.absoluteString{ if urlStr != Constants.Staging.lobbyScreen { let modifiedUrl = urlStr + "?display_mode=app" if urlStr != Constants.Staging.cashfreeDeposite { //mutable url request code goes here webView.load(mutableRequest as URLRequest) } else { createPopupWebView(for: modifiedUrl, config: configuration) } }else { webView.load(navigationAction.request) } } } return nil } }