I don\'t why my question is marked as duplicate of this one, first I execute javascript code with evaluateJavaScript as the question title shows which it\'s
First of all you need to implement the required WKUIDelegate methods, in your case you need to implement:
optional func webView(_ webView: WKWebView,
runJavaScriptAlertPanelWithMessage message: String,
initiatedByFrame frame: WKFrameInfo,
completionHandler: @escaping () -> Void)
{
// parameter **message** will hold your actual alert message.
// Write Your Customised code to display the alert message
}