JavaScript alert() 在嵌入式 WebView 中不起作用 [英] JavaScript alert() not working in embedded WebView

查看:29
本文介绍了JavaScript alert() 在嵌入式 WebView 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嵌入时 WebView 在应用程序中加载 html 页面,JavaScripts alert()/confirm()/etc.不工作.

When embedding WebView in an application and loading html-pages in it, JavaScripts alert()/confirm()/etc. do not work.

查看文档,WebPreferences - 唯一看起来相关的是 WebUIDelegates -(void)webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame: 等...但实现这些意味着为这些编写自定义对话框,这似乎是多余的...
我不需要自定义 WebUIDelegate 并且想继续使用默认的.

Looking around in the documentation, there are no related settings in WebPreferences - the only thing that looks related are WebUIDelegates -(void)webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame: etc ... but implementing these would mean writing custom dialogs for these which seems pretty redundant...
I don't need a custom WebUIDelegate and would like to continue just using the default one.

当然必须有某种方法来简单地启用 alert() 等,但是如何?

Surely there has to be some way to simply enable alert() et al, but how?

推荐答案

事实证明根本没有默认的 WebUIDelegate 集 - Apple 似乎希望每个人都为自己实现相同的基本功能.

It turns out there is simply no default WebUIDelegate set - Apple seems to expect everyone to implement the same basic features for themselves.

这篇关于JavaScript alert() 在嵌入式 WebView 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆