Skip to content

Commit

Permalink
feat: add ability to close webview from javascript on ios
Browse files Browse the repository at this point in the history
  • Loading branch information
malua authored Dec 30, 2024
1 parent c5eae97 commit 5034997
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ios/Plugin/WKWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
}
print("[InAppBrowser - preShowScriptError]: Error!!!!")
semaphore.signal()
} else if message.name == "close" {
closeView()
}
}

Expand Down Expand Up @@ -299,6 +301,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
userContentController.add(self, name: "messageHandler")
userContentController.add(self, name: "preShowScriptError")
userContentController.add(self, name: "preShowScriptSuccess")
userContentController.add(self, name: "close")
webConfiguration.userContentController = userContentController
let webView = WKWebView(frame: .zero, configuration: webConfiguration)

Expand Down

0 comments on commit 5034997

Please sign in to comment.