【发布时间】:2015-01-02 12:00:44
【问题描述】:
我有一个嵌入的 WebView toWeb 加载本地 HTML 文件。
我的警报alert("Some message"); 没有被触发
UIDelegate 设置在toWeb
我在这里检查过: JavaScript alert() not working in embedded WebView
和WKUIDelegate Protocol Reference
想出了
func toWeb(sender: WebView!, runJavaScriptAlertPanelWithMessage message: String!) {
let myPopup:NSAlert = NSAlert()
myPopup.addButtonWithTitle("OK")
myPopup.messageText = "An alert";
myPopup.informativeText = "Message"
if myPopup.runModal() == NSAlertFirstButtonReturn {
}
但是我仍然没有收到来自我嵌入的 WebVieW 的任何警报
【问题讨论】:
标签: javascript macos cocoa swift webview